Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use 64-bit Java ODBC driver with a Access database on Windows 2008?

For years, on 32-bit systems I have never had a problem. Why can't I use 64-bit Java ODBC driver with a Access database on Windows Server 2008? Is the ODBC driver on a 64-bit system written in 32-bit code or something? Here is the error I see, using a 64-bit JDK1.6.018 :

java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
        at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073)
        at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
        at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
       .....

I suspect that the Access driver is 32-bit because it doesn't show up in the 64-bit ODBC control panel for windows. Only two 64-bit drivers (for SQL Server) are visible in the "Drivers" tab of the ODBC control panel.

So, what can I do? I would rather not have to use SQL Server and the JDBC Type-4 driver (but that would be my last resort).

like image 407
djangofan Avatar asked Mar 04 '10 17:03

djangofan


People also ask

How do I change ODBC 32-bit drivers to 64-bit?

To create or modify the 64-bit ODBC Data Source on Windows 64-bit, access the ODBC Data Source Administrator directly from the Start menu or Control Panel. To create or modify the 32-bit ODBC Data Sources on 64-bit Windows, run the 32-bit ODBC Data Source Administrator from C:\WINDOWS\SysWOW64\odbcad32.exe.

Can I can connect a 64-bit application to a 32-bit ODBC driver?

Yes, you can connect a 64-bit application to a 32-bit ODBC driver by using the ODBC-ODBC Bridge. Without the ODBC-ODBC Bridge, a 64-bit application cannot connect to a 32-bit ODBC driver. 64-bit applications must be linked against 64-bit libraries.


2 Answers

Have you tried launching the 32-bit ODBC manager from Windows 2008 - to see if that helps you diagnose the issue?

The 32-bit version of the Odbcad32.exe file is located in the %systemdrive%WindowsSysWoW64 folder

like image 92
Ta01 Avatar answered Oct 24 '22 18:10

Ta01


I had same problem. The cause was that i was using 64 Bit ODBC DSN with a 32 Bit JDK. These should be same architecture (both ODBC DSN and JDK need to be either 64 bits or 32 bits). If you would register ODBC DSN on 32 bits and calling from a 64 bit application (64 bit JVM) you would get an error that DSN source is not found (So for the application to see the ODBC source - the JVM you are running the app should be same architecture as ODBS DSN: both needs to be 64 bits, or both 32 bits). Hope this helps.

like image 22
Oleg Efrem Avatar answered Oct 24 '22 17:10

Oleg Efrem