locked
jdbc connectivity in window7 64 bit RRS feed

  • Question

  • I've been trying to connect to a MS Access 2007 database through JDBC. My JDK is JDK 1.6u18 64-bit and OS is Windows 7 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 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? My OS as well as JDK are 64-bit. Can't I connect to a Access 2007 database. Any help would be highly appreciated.
    Thursday, August 19, 2010 8:23 PM

Answers

All replies

  • Since you posted to the below thread I'm sure you are aware of the issue:

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/ef10d625-80d9-4666-b33e-d2f27fde9db5

    If your app is 64-bit then you need the 64-bit Access Database Engine:

    http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Friday, August 20, 2010 1:46 PM
  • hi , i've been trying to connect java(using netbeans) with microsoft access 2010 (64 bit). i used the following code- ---------------- package javaaccess; import java.sql.*; public class Main { public static void main(String[] args) { Connection con; Statement stmt; ResultSet rs; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String db = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb, *.accdb)};DBQ=c:\\users\\Achu\\Desktop\\tommy\\just.accdb"; con = DriverManager.getConnection( db ); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM accounts"); while (rs.next()) { String x = rs.getString("username"); System.out.println(x); } }catch(Exception e) { System.out.println(e); } } } ------------------ now i have access database driver 2010 installed but even still i get the error it says- ----------------- java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ------------- please help me ...
    Tuesday, April 12, 2011 8:30 PM
  • If you have the 64-bit Access Database Engine installed then your Java app needs to run 64-bit.

    Sorry, but I can't help with any of the Java code itself.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, April 12, 2011 9:58 PM