architecture mismatch between the Driver and Appli

2019-01-19 22:10发布

问题:

I am using JDBC to connect to my microsoft access database. I get the following exception when I try to connect to the database:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

I am using 64bit windows7, and I am using eclipse which is also a 64bit version My database is a microsoft access database and it seems that the driver is a 32bit driver which is causing the problem.

Any help on how to solve this problem would be greatly appreciated.

回答1:

Check out the access 2010 redist

Microsoft Access Database Engine 2010 Redistributable

This download will install a set of components that can be used by non-Microsoft Office applications to read data from and write data to Office 2010 system files such as Microsoft Access 2010 (mdb and accdb) files and Microsoft Excel 2010 (xls, xlsx, and xlsb) files. Connectivity to text files is also supported. ODBC and OLEDB drivers are installed for application developers to use in developing their applications with connectivity to Office file formats.

This should suit your needs. Good luck!



回答2:

I don't have enough reputation yet to vote Yoda up, but I have to say that his solution is the most elegant I've come across. You could have also used a 32-bit JVM, but that is kind of silly. (If you encounter this on IIS you can make the application pool 32-bit, which is sort of the same thing.)