views:

886

answers:

1

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.

I read somewhere that microsoft has not released a 64bit driver for microsoft access!

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

+2  A: 

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!

Yoda
Thank you for your response.I am using Microdoft Office 2006 does this matter?It says in the instructions on the download page that:(If you are application developer using ODBC to connect to Microsoft Office Access data, set the Connection String to “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”) my code currently connects in the following way: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");connection = DriverManager.getConnection("jdbc:odbc:users"); Im not sure as to where to put the connection string which is mentioned in the instructions?thanks again
shane87
Change the parameters of DriverManager.getConnection to the connection string, use the following example as a reference it includes your connection string:http://www.rgagnon.com/javadetails/java-0107.htmlIf that works out for you, an upvote and accepted answer would be nice ;) and if not give me a shout.
Yoda
And I'm fairly sure the drivers will be backwards compatible so shouldn't be an issue.
Yoda
There is no such thing as "Microsoft Access 2006".
David-W-Fenton