Windows 7 Access DB Connection Error "Architecture Mismatch"
Will Barbee
Ranch Hand
Joined: Oct 01, 2008
Posts: 40
posted
0
I am using Windows 7 and MS Access 2007 for a Java application.
First, to set up the ODBC connection, I had to use a 32-bit version of the Admin tools.
That is, odbcad32 in c:/windows/syswow64.
(See Microsoft SQL Server Developer forum entries.)
I then used the DB Name for the driver and also selected the DB itself for the driver.
I got it set up and followed some old code I had to connect to the DB.
After some initial errors, I am partially connecting which means that the code is correct, I think.
The code follows:
I have the following error message from the DriverManager.getConnection statement (#18 above):
"The specified DSN contains an architecture mismatch between the Driver and Application"
So there is some problem in my ODBC setup or in the DB. But what is it?
I think you analysis that this is a 32 vs 64 bits issue is right.
What happens if you set up a data source with c:\windows\system32\odbcad32.exe ?
That is bad advise. It doesn't work for Access.
This message was edited 1 time. Last update was at by Jan Cumps
Will Barbee
Ranch Hand
Joined: Oct 01, 2008
Posts: 40
posted
0
I forgot to say that I am using a fairly new Win7 and MS Office Professional 2007.
And that means Access is 2007.
And the code I have worked for Access 2003.
Yes, I think it is a 32-bit/64-bit issue.
The problem is that if you use the Control Panel / Admin Tools / Data Sources (ODBC) program,
you will only get (MS) SQL Server as a driver. To get MS Access drivers, you MUST use the 32-bit
program.
The programs are getting through the Class.forName statement (Java ODBC Driver Name) OK.
But the DriverManager.getConnection gives the error.
Is there some glitch in Microsoft Win7 or Access 2007 (which costs minimum $159 to even talk to them)?
Or is there some disconnect in the sun.jdbc.odbc.JdbcOdbcDriver where 32-bit/64-bit
is connecting to Access 2007?