Java Access DB Connection

筅森魡賤 提交于 2019-12-01 06:05:43

There is nothing fundamentally wrong with your code because I pasted it into Eclipse and it ran fine. The only change I made was to specify the path to the database file, i.e., instead of using

DBQ=myDB.mdb

I used

DBQ=C:\\__tmp\\myDB.mdb

I was also running it under a 32-bit JVM (on a 32-bit computer). So, my suggestions would be

  1. Try specifying the complete path to the .mdb file like I did.

  2. If you still get an error, check your Java environment to see if your application is running in a 64-bit JVM. If it is, then Driver={Microsoft Access Driver (*.mdb)} will not work: there is no 64-bit version of the older Jet ODBC driver. In that case you have two options:

    i. Configure your application to run in a 32-bit JVM, or

    ii. Download and install the 64-bit version of the Access Database Engine from here, and then use Driver={Microsoft Access Driver (*.mdb, *.accdb)}.

Gord Thompson

Now that the JDBC-ODBC Bridge has been removed from Java 8 a better approach would be to use the UCanAccess JDBC driver. For more information see

Manipulating an Access database from Java without ODBC

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!