This discussion is archived
3 Replies Latest reply: Nov 13, 2012 9:05 PM by EJP RSS

JDBC-ODBC Connection problem between MS-Access2007 & Java in Windows7 64bit

767124 Newbie
Currently Being Moderated
I've been trying to connect to a MS Access 2007 (SP3) database through JDBC. My JDK is JDK 1.7.0_09 64-bit and OS is Windows 7 (SP1) 64-bit. But problem is I am unable to create a DSN using Windows\system32\odbcad32.exe because it doesn't show ODBC drivers for MS Access at all, it's only showing drivers for MS SQL Server.




When tried to click on Configure for "MS Access Database" (which is an already created DSN, I guess), it first shows error message : "The setup routines for the Microsoft Access Drivers (*.mdb, *.accdb) ODBC Driver could not be found. Please reinstall the driver." And then another message : "Errors found! The specified DSN contains an architecture mismatch between the Driver and Application."




After reading in forume.

The %windir%\SysWOW64\odbcad32.exe in Windows\SysWOW64 does let me create a DSN for MS Access, it shows the drivers installed properly. However, when tried to connect to that DSN through a Java program, I get the following exception :




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(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)

at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)

at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at AccessTest.main(AccessTest.java:19)




What might be the problem and what do I have to do to get it working? Any help would be highly appreciated.
  • 1. Re: JDBC-ODBC Connection problem between MS-Access2007 & Java in Windows7 64bit
    rp0428 Guru
    Currently Being Moderated
    >
    What might be the problem and what do I have to do to get it working?
    >
    Just a shot in the dark but could the error 'an architecture mismatch between the Driver and Application' refer to you doing this?
    >
    I am unable to create a DSN using Windows\system32\odbcad32.exe
    >
    Everything else is 64 bit. That 'odbcad32.exe' looks like it might be 32 bit. Is there a 64 bit version of odbc on the system you can try?
    This support article seems to say you are using the 64 bit version but you might try the other one.
    http://support.microsoft.com/kb/942976
  • 2. Re: JDBC-ODBC Connection problem between MS-Access2007 & Java in Windows7 64bit
    767124 Newbie
    Currently Being Moderated
    With reference to the article http://support.microsoft.com/kb/942976

    when I am trying

    The 32-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\SysWoW64 folder - It is possible to create the DSN but getting runtime error

    *"sun.jdbc.odbc.JbbcOdbcDriverException >>> [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application"*


    In other case i.e. The 64-bit version of the Odbcad32.exe file is located in the %systemdrive%\Windows\System32 folder - It could not be possible to create DSN (Error already given in original post)
  • 3. Re: JDBC-ODBC Connection problem between MS-Access2007 & Java in Windows7 64bit
    EJP Guru
    Currently Being Moderated
    So you still have an "architecture mismatch between the Driver and Application", and you have an MSDN article explaining what to do about it. Not a Java question at all. Locking this thread.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points