keeps / dbptk-developer

DBPTK Developer - library and command-line tool for execution of database preservation actions
http://www.database-preservation.com
GNU Lesser General Public License v3.0
43 stars 19 forks source link

JDBC driver class could not be found #1

Closed atomotic closed 9 years ago

atomotic commented 11 years ago

do i need to download myself an Access jdbc driver?

$ java -jar db-preservation-toolkit-1.0.0-jar-with-dependencies.jar -i MSAccess books.mdb -o DBML ./books/   

INFO 2013-09-16 12:37:59,699 (Main) Translating database: MsAccessImportModule to DBMLExportModule
ERROR 2013-09-16 12:37:59,707 (Main) Error while importing/exporting
pt.gov.dgarq.roda.common.convert.db.model.exception.ModuleException: JDBC driver class could not be found
    at pt.gov.dgarq.roda.common.convert.db.modules.jdbc.in.JDBCImportModule.getDatabase(JDBCImportModule.java:538)
    at pt.gov.dgarq.roda.common.convert.db.Main.main(Main.java:93)
Caused by: java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:171)
    at pt.gov.dgarq.roda.common.convert.db.modules.msAccess.in.MsAccessImportModule.getConnection(MsAccessImportModule.java:55)
    at pt.gov.dgarq.roda.common.convert.db.modules.jdbc.in.JDBCImportModule.getDatabaseStructure(JDBCImportModule.java:174)
    at pt.gov.dgarq.roda.common.convert.db.modules.jdbc.in.JDBCImportModule.getDatabase(JDBCImportModule.java:523)
    ... 1 more
luis100 commented 11 years ago

No, you don't need to download the driver an MS Access JDBC, because there is none (to my knowledge). The current MS Access import module uses ODBC, which is the Windows analogue of JDBC, to connect to MS Access databases.

Therefore, to import from MS Access databases you need to run the db-preservation-toolkit on a Windows machine, which will already have the sun.jdbc.odbc.JdbcOdbcDriver installed. Also, to be able to connect to MS Access via the JDBC-ODBC bridge, you need to have the MS Access ODBC driver installed, which means you need to have Microsoft Access installed on your system.

In summary, you need Windows and Microsoft Access installed to import from Microsoft Access files. I realize I forgot to add this information to the Readme and will do so.

Can you test it and tell me how it goes?

atomotic commented 11 years ago

ok, thank you. i was on a linux machine, but i was in doubt that windows was needed. i'll try soon.