views:

599

answers:

3

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).

A: 

Microsoft Access in Office 2010 will have a 64 bit version. Earlier versions of Microsoft Office are 32 bit only.

Using SQLExpress is both free and easy enough to use, and Access and Java can connect to it, so it seems like a good choice.

Since you said that was a last resort, the other option is to run the 32-bit JDK, which should run fine on Server 2008.

Yishai
i believe there is a problem running the 32-bit JDK on a 64-bit machine. i suspect it has something to do with how the JVM uses .dlls to handle memory (RAM) management. i had trouble, when i tried, which is why im using the 64-bit jdk.
djangofan
@djangofan, the limitation will be in how much memory the JVM can use. Of course, if there are subtle issues, I wouldn't necessarily know.
Yishai
yes, probably true. i thought the same think you did, at first...
djangofan
The beta of the 64-bit ACE is already downloadable and other people here on SO have said they have used it and had success.
David-W-Fenton
that worked. you get the answer.
djangofan
+1  A: 

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

RandomNoob
A: 

I have the same problem and the solution, in my case, is to use a 32-bit jdk

marcosn