2
votes

I am trying to connect MS office access with my java code using odbc driver.

Precisely, In ODBC data source Administrator, as I click the add button, the Create New Data Source dialog box appears.

But I can't find the Microsoft access driver (*.mdb *.accdb) option.

There is only one option named SQL Server. My problem is shown in the image given below. I am using Windows 7. Where is this Microsoft access driver (*.mdb *.accdb) option?

enter image description here

2

2 Answers

0
votes

Microsoft stopped shipping the driver with Windows. If you don't have Access installed, you probably don't have the database driver.

You can download the Microsoft Access Database Engine here, which will allow you to open Access files.

0
votes

Based on your screenshot, I'd say you're hitting a bitness mismatch between your ODBC driver and your ODBC client (Java, in this case) on 64-bit Wndows. See this article for some basics about that.

Most commonly for what you've shown, you're probably running a 32-bit Java on 64-bit Windows 7, where you have a 32-bit ODBC Driver for SQL Server (seen in the Drivers list) and a 64-bit ODBC Driver for MS Access (used by the User DSNs seen in the Administrator window behind).

  • If you want to stick with the installed (or newer, through Java 7) 32-bit Java, you'll need to download and install 32-bit data access components for the right version of MS Access (this link will get you components for MS Access 2010).

  • If you update to a 32-bit Java 8 or later, you'll need to download and install 32-bit data access components for the right version of MS Access (this link will get you components for MS Access 2010), and you'll need to also add a third-party JDBC-to-ODBC Bridge (like this from my employer).

  • If you switch to a 64-bit Java 7 or earlier (which retains the Sun/Oracle JDBC-to-ODBC Bridge), you can use the existing 64-bit ODBC Driver for Access.

  • If you switch to a 64-bit Java 8 or later, you can use the existing 64-bit ODBC Driver for Access, but you'll need to also add a third-party JDBC-to-ODBC Bridge (like this from my employer).

That said -- you might be running running a 64-bit Java on 64-bit Windows 7, where you have a 64-bit ODBC Driver for SQL Server (seen in the Drivers list) and a 32-bit ODBC Driver for MS Access (used by the User DSNs seen in the Administrator window behind).

  • If you want to stick with the installed (or newer, through Java 7) 64-bit Java, you'll need to download and install 64-bit data access components for the right version of MS Access (this link will get you components for MS Access 2010).

  • If you update to a 64-bit Java 8 or later, you'll need to download and install 64-bit data access components for the right version of MS Access (this link will get you components for MS Access 2010), and you'll need to also add a third-party JDBC-to-ODBC Bridge (like this from my employer).

  • If you switch to a 32-bit Java 7 or earlier (which retains the Sun/Oracle JDBC-to-ODBC Bridge), you can use the existing 32-bit ODBC Driver for Access.

  • If you switch to a 32-bit Java 8 or later, you can use the existing 32-bit ODBC Driver for Access, but you'll need to also add a third-party JDBC-to-ODBC Bridge (like this from my employer).