开发者

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 th开发者_开发百科e 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).


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


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.


If you use Microsoft Office 2010, which will return into the 64 bit architecture. So, it will remove this error related to architecture mismatch between driver and the application.


I had the same problem and the solution, in my case, was to use a 32-bit JDK.


In my case, I had a 32 bit JDK 6u45 on a XP that used the jdbc:odbc driver to query a .accdb file. So I had a 32 bit JDK and also a 32 bit MS Office which automatically installed the necessary driver in my computer when I installed it. Then I moved the project to a Windows 7 with a Netbeans 7.3 with a 32 bit JDK 6u45 BUT a 64 bit MS Office 2013 so that seems to be the problem, If you have a 32 bit JDK installed then you need a 32bit version of Office (with the proper driver that comes with that Office version). And the same with 64 bit version.

In my case I searched Oracle's Java archive for the 64 bit version of JDK6u45 and changed the JDK of the project to the 64 bit version.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜