nullpointerexception - UCanAccess driver throws Exception when trying to connect with Access database while Jackcess connection works fine -
1) ucanaccess sample code works database (access 2000)
class.forname("net.ucanaccess.jdbc.ucanaccessdriver"); connection conn = drivermanager.getconnection(database_url); system.out.println(conn);
2) same ucanaccess sample code not work database b (access 2000) , leads exception stack trace:
net.ucanaccess.jdbc.ucanaccesssqlexception @ net.ucanaccess.jdbc.ucanaccessdriver.connect(ucanaccessdriver.java:247) @ java.sql.drivermanager.getconnection(drivermanager.java:571) @ java.sql.drivermanager.getconnection(drivermanager.java:233) @ xxxxxxxxxx.jdbcaccessconnection.main(jdbcaccessconnection.java:23) caused by: java.lang.nullpointerexception @ net.ucanaccess.converters.ucanaccesstable.getindexes(ucanaccesstable.java:74) @ net.ucanaccess.converters.loadjet$tablesloader.loadtableindexesuk(loadjet.java:794) @ net.ucanaccess.converters.loadjet$tablesloader.createindexesuk(loadjet.java:835) @ net.ucanaccess.converters.loadjet$tablesloader.loadtables(loadjet.java:921) @ net.ucanaccess.converters.loadjet$tablesloader.access$3(loadjet.java:919) @ net.ucanaccess.converters.loadjet.loaddb(loadjet.java:1311) @ net.ucanaccess.jdbc.ucanaccessdriver.connect(ucanaccessdriver.java:236) ... 3 more
3) following jackcess sample code works database b (with ucanaccess not work) , leads following output
table table = databasebuilder.open(new file(database_file_path)).gettable(tablename); (column column : table.getcolumns()) { system.out.println("column " + column); }
output:
column textcolumn@9234336[ name: (xxxxxxxxxxxxx) table type: 0xa (text) number: 0 length: 100 variablelength: true compressedunicode: true textsortorder: sortorder[1033(0)] ] column column@dc8092a[ name: (xxxxxxxxxxxxx) attached type: 0x1 (boolean) number: 1 length: 1 variablelength: false ] column textcolumn@47d1ab77[ name: (xxxxxxxxxxxxx) database type: 0xa (text) number: 2 length: 100 variablelength: true compressedunicode: true textsortorder: sortorder[1033(0)] ] column textcolumn@16503677[ name: (xxxxxxxxxxxxx) path type: 0xa (text) number: 3 length: 100 variablelength: true compressedunicode: true textsortorder: sortorder[1033(0)] ]
has idea how ucanaccess work right ? in database b there lot of links other .mdb files
4) ucanaccess error consol shows this:
please, enter full path access file (.mdb or accdb): c:\users\xxx \desktop\xxx.mdb loaded tables: loaded queries: loaded indexes: primary key on berechtigungen columns: (index,userid) , primary key on dg_fehler columns: (zaehler) , primary key on fehlertabelle_sich columns: (fc,bc,sfbereich) , primary key on fgjg1_fehler columns: (zaehler) , primary key on grundschulen_lokal columns: (snr) , index unique on nrw_strassen columns: (id) , primary key on pwrd columns: (userid) , primary key on schultr─gerart columns: (schultr─gerart) , primary key on tabellenzumhost columns: (tabelle) , primary key on tabellenzumhost_bk columns: (tabelle) , primary key on tabellenzumhost_weiteretabs columns: (tabelle,weiteretabelle) , primary key on userid columns: (userid) , primary key on userkonv columns: (userid) , primary key on zfehlertabelle columns: (fc,bc,sfbereich) net.ucanaccess.jdbc.ucanaccesssqlexception @ net.ucanaccess.jdbc.ucanaccessdriver.connect(ucanaccessdriver.java:24 7) @ java.sql.drivermanager.getconnection(unknown source) @ java.sql.drivermanager.getconnection(unknown source) @ net.ucanaccess.console.main.main(main.java:151) caused by: java.lang.nullpointerexception @ net.ucanaccess.converters.ucanaccesstable.getindexes(ucanaccesstable. java:74) @ net.ucanaccess.converters.loadjet$tablesloader.loadtableindexesuk(loa djet.java:794) @ net.ucanaccess.converters.loadjet$tablesloader.createindexesuk(loadje t.java:835) @ net.ucanaccess.converters.loadjet$tablesloader.loadtables(loadjet.jav a:921) @ net.ucanaccess.converters.loadjet$tablesloader.access$3(loadjet.java: 919) @ net.ucanaccess.converters.loadjet.loaddb(loadjet.java:1311) @ net.ucanaccess.jdbc.ucanaccessdriver.connect(ucanaccessdriver.java:23 6) ... 3 more null drücken sie eine beliebige taste . . . (en: press button continue . . . )
please execute using jackcess:
for (string tn : database.gettablenames()) { system.out.println(tn); system.out.println(database.gettable(tn)); }
this may understand , solve. please, give me feedback.
Comments
Post a Comment