0

I was trying to connect to an access database using jdbc and swings. However, I could not find any MS Access Database driver (*.mdb) in the ODBC Data Source Control panel. The only one available is that of SQL Server. After reading a bit into it, I guess it happened because my OS was 64 bit and my MS Access was 32 bit.

Then, I went to Windows/sysWOW64/odbcad32.exe

There, I could find the Microsoft Access Database Driver. I made the appropriate connection to the database, with the name 'avi' and ran it again.

I got this error

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 Conn.updt(Conn.java:25)

Conn.java lines 24 and 25:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:avi");

I still think its a 32-64 bit problem, but is there any turnaround? Something that would not require a lot of expertise since I'm not much familiar with this.

Shashank Singh
  • 283
  • 1
  • 5
  • 16

1 Answers1

1

--From MSDN --

To manage a data source that connects to a 32-bit driver under 64-bit platform, use c:\windows\sysWOW64\odbcad32.exe. To manage a data source that connects to a 64-bit driver, use c:\windows\system32\odbcad32.exe.

If you use the 64-bit odbcad32.exe to configure or remove a DSN that connects to a 32-bit driver you will receive this message.

user1127214
  • 3,109
  • 7
  • 26
  • 30
  • Thanks for the info :) Here, my data source is an MS Access 2007 database named 'avi' which Im trying to connect. The driver is 32-bit odbcad32.exe. The system32/odbcad32.exe has no driver for access. Only SQL Server. still hunting for a solution... – Shashank Singh Apr 21 '12 at 15:25