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
Try specifying the complete path to the
.mdb
file like I did.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)}
.