1
如何備份/恢復我的Java應用程序內的任何種類的數據庫flate files.Are有任何工具框架可用於備份數據庫平面文件如CSV,XML或安全加密文件,或恢復從csv或xml文件到數據庫,它也應該能夠轉儲桌面還原和備份。java數據庫備份和恢復
如何備份/恢復我的Java應用程序內的任何種類的數據庫flate files.Are有任何工具框架可用於備份數據庫平面文件如CSV,XML或安全加密文件,或恢復從csv或xml文件到數據庫,它也應該能夠轉儲桌面還原和備份。java數據庫備份和恢復
有很多方法可以做到這一點。這真的取決於你的「數據庫」有多複雜。
最簡單的辦法是寫在一個CSV格式的文本文件:
import java.io.PrintWriter;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FileOutput {
public static void main(String[] args) {
File file = new File("C:\\MyFile.csv");
FileOutputStream fis = null;
PrintWriter output = null;
try {
fos = new FileOutputStream(file);
output = new PrintWriter(fos);
output.println("Column A, Column B, Column C");
// dispose all the resources after using them.
outputStream.flush();
fos.close();
outputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
或者,如果你正在尋找的XML解決方案,您可以使用Xerces API,我認爲這是包括打在最新的JDK中,所以你只需要包含這些包。
thanx for reply 我覺得我的擔心要大得多 – jawath 2010-04-07 06:04:36