我正在使用Jackcess API將我的數據庫複製到文件中。我成功地建立了連接到我的數據庫,但是當我嘗試打開數據庫時,我得到一個空指針異常。使用Jackcess打開Access數據庫文件
我的代碼
File tempTarget=File.createTempFile("eap-mirror", "eap");
String conString = EaDbStringParser.eaDbStringToJdbc(sourceString);
this.source=DriverManager.getConnection(conString);
this.source.setReadOnly(true);
try {
FileUtils.copyFile(new File(templateFileString), tempTarget);
System.out.println("file copied");
} catch (IOException e) {
e.printStackTrace();
}
this.target=Database.open(tempTarget,false,false); //Cannot run this line
我不能夠運行Database.open方法,因此目標爲null會拋出異常。
任何人有任何想法我做錯了什麼或在這裏需要什麼?
由於
可能重複的[Jackcess DatabaseBuilder.open失敗](http://stackoverflow.com/questions/29844258/jackcess-databasebuilder-open-fails) –