none
The error "The specified DSN contains an architecture mismatch between the Driver and Application" coming while connecting JAVA to MS Access 2007 in Windows 7 Plateform.

    Question

  • Hello.
    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.
    Tuesday, August 17, 2010 6:40 AM

Answers

  • OK, in that case you will need 64-bit drivers if your Java app is running 64-bit. I believe there is a 64-bit download at the below link:

    Microsoft Access Database Engine 2010 Redistributable

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, August 18, 2010 9:33 PM
  • Hi Paul,

    Thanks for your continuous help!!!

    As per your suggestion I have tried to install "AccessDatabaseEngine_X64" driver, but its throwing below error:

    You Cannot install the 64-bit MS Access Database Engine 2010 because you currently have 32-bit Office products installed.

    Regards,
    Bob

    Yes, this stems from the fact that Microsoft does not support the side-by-side installation of the 32 and 64-bit versions of Microsoft Office. If you can't uninstall the 32-bit version then your Java app will have to be 32-bit.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Friday, August 20, 2010 12:19 AM

All replies

  • Is your application running as a 64-bit process? It sounds to me like it's looking for a 64-bit ODBC driver.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, August 17, 2010 12:48 PM
  • Thanks Paul 4 reply....

    MS Access is running on 32 bit.

     

    Wednesday, August 18, 2010 7:33 AM
  • I'm sorry, I thought you were attempting to open the Access database from a Java application. Is this incorrect?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, August 18, 2010 5:09 PM
  • Yes u r right.....I am doin database connectivity between JAVA n MS Access...

    Thanks

    Wednesday, August 18, 2010 7:43 PM
  • OK, in that case you will need 64-bit drivers if your Java app is running 64-bit. I believe there is a 64-bit download at the below link:

    Microsoft Access Database Engine 2010 Redistributable

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, August 18, 2010 9:33 PM
  • Hi Paul,

    Thanks for your continuous help!!!

    As per your suggestion I have tried to install "AccessDatabaseEngine_X64" driver, but its throwing below error:

    You Cannot install the 64-bit MS Access Database Engine 2010 because you currently have 32-bit Office products installed.

    Regards,
    Bob
    Thursday, August 19, 2010 7:31 PM
  • I also face same problem please anyone help me.my mail id is swasti092@gmail.com.
    Thursday, August 19, 2010 8:23 PM
  • Hi Paul,

    Thanks for your continuous help!!!

    As per your suggestion I have tried to install "AccessDatabaseEngine_X64" driver, but its throwing below error:

    You Cannot install the 64-bit MS Access Database Engine 2010 because you currently have 32-bit Office products installed.

    Regards,
    Bob

    Yes, this stems from the fact that Microsoft does not support the side-by-side installation of the 32 and 64-bit versions of Microsoft Office. If you can't uninstall the 32-bit version then your Java app will have to be 32-bit.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Friday, August 20, 2010 12:19 AM
  • Yes, this stems from the fact that Microsoft does not support the side-by-side installation of the 32 and 64-bit versions of Microsoft Office. If you can't uninstall the 32-bit version then your Java app will have to be 32-bit.
    Paul ~~~~ Microsoft MVP (Visual Basic)

    Hi

    Since I can't uninstall 32 bit version of Microsoft office and can't install the 64 bit drivers, how can i turn my java application to be 32-bit ?

    FYI:

    I had to set data sources ODBC target = %windir%\syswow64\odbcad32.exe

    and start in = %windir%\syswow64

    in order to create my ODBC source and use MSaccess drivers.

    Thanks for your help

    • Proposed as answer by enovac Thursday, November 11, 2010 1:30 AM
    Friday, October 08, 2010 1:16 PM
  • Hello.
    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.

    • Proposed as answer by ASHUTOSH123 Thursday, November 18, 2010 3:59 PM
    Thursday, November 18, 2010 3:59 PM
  • Hi,

    I'm having issues with trying to connect to Access 2007 via Java as well.  I'm running Windows 7 32bit, and Access 2007.

    Here is there error I get trying to connect to Access:

    Database Connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Problem: null

    I can't seem to get connected to Access 2007.  When I try the same code in XP with Access 2003, it works fine.  I have made all the necessary adjustments in the code to connect with Access 2007 but it fails every time.

    Any help would be awesome.  I will continue to try to resolve this and will post a solution if/when I find one.

    Thursday, February 17, 2011 4:36 AM
  • I have same problem.

    I think the sys32 does not have the correct driver. but the system refuse to visit syswow64 for search the driver....

    is it any problem with jdk?

    Wednesday, March 23, 2011 11:28 PM
  • Hi

    I used Thrakazz's approach but made a slight adjustment to suit my situation.

     

    Likewise, I set the data sources target = %windir%\SysWow64\odbcad32.exe

    but start in = &windir%\system32

     

    Much appreciated!

    Tuesday, June 28, 2011 7:40 PM
  • Hi thrakkazz,

    Thank you so much for the solution :-)

     

    Tuesday, August 23, 2011 1:04 AM
  • Hi BobLarsen,

     

    May i know how you overcome this issue?

    Because i stuck on this errors.

    Please help on this error...

     

    • Proposed as answer by VirDeus Sunday, October 09, 2011 4:44 AM
    • Unproposed as answer by VirDeus Sunday, October 09, 2011 4:44 AM
    Tuesday, October 04, 2011 4:34 AM
  • Hi BobLarsen,

     

    May i know how you overcome this issue?

    Because i stuck on this errors.

    Please help on this error...

     

    In order to run Java with an ODBC connection in Windows 7 64bit you must first determine which MS Office bit version you have. Everything must match the MS Access bit version.

     

    If you are using MS Office 64bit then you can download the 64bit driver here http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13255. You would then use the ODBC Manager located at C:\Windows\SysWOW64\odbcad32.exe to create the DSN. You will also need to insure that you have the 64bit JRE installed. The JRE version should also match the JDK (ie, JRE 7 and JDK 7). Then run the default 64bit command prompt. JDK bit version is irrelevant since the compilation is in byte mode.

     

    If you are using MS Office 32bit then you do not need to install the 64bit driver listed above. You would then use the ODBC Manager located at C:\Windows\SysWOW64\odbcad32.exe to create the DSN. In order to run the applet in 32bit mode, you must open the 32bit CMD Prompt located at C:\Windows\SysWOW64\cmd.exe.

     

    One note: The browser bit version must also match the MS Office bit version. So if you use MS Office 32bit and therefore run the 32bit driver, you cannot view it in a 64bit Internet Explorer or any other 64bit browser when they come out and actually work right. :)


    • Edited by VirDeus Sunday, October 09, 2011 4:47 AM
    Sunday, October 09, 2011 4:45 AM
  • thanks, it's usefull for me...

    for windows 7 64-bit -->C:\Windows\SysWOW64\odbcad32.exe

    Tuesday, February 07, 2012 10:37 AM
  • I have similar situation here..

    OS: 2008 server

    JDK/JRE: 32 bit

    Java Application version: 32 bit

    Created ODBC data source and the test was successful.

    And I am trying to connect to installed SQL Server 2008 on this OS using the above ODBC data source with the 32 bit SQL server driver. I am seeing architecture mismatch error. Per above comments I do not find what else need to be changed? what is still missing? Anything is much appreciated.




    • Edited by rathpl Wednesday, March 07, 2012 4:51 AM
    Wednesday, March 07, 2012 4:45 AM
  • :-) now it works...

    Created ODBC data source using C:\Windows\SysWOW64\odbcad32.exe

    Wednesday, March 07, 2012 4:58 AM
  • 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 in advance

    Thursday, March 15, 2012 1:57 PM
  • Yes, this stems from the fact that Microsoft does not support the side-by-side installation of the 32 and 64-bit versions of Microsoft Office. If you can't uninstall the 32-bit version then your Java app will have to be 32-bit.
    Paul ~~~~ Microsoft MVP (Visual Basic)

    Hi

    Since I can't uninstall 32 bit version of Microsoft office and can't install the 64 bit drivers, how can i turn my java application to be 32-bit ?

    FYI:

    I had to set data sources ODBC target = %windir%\syswow64\odbcad32.exe

    and start in = %windir%\syswow64

    in order to create my ODBC source and use MSaccess drivers.

    Thanks for your help

    thrakkazz - 

    How/where/when do you do these things (set "data sources ODBC target ", set "start in ")?  Is it in your Java code or a Windows admin facility?  Please explain a little more.

    Also, it seems like you were actually asking a question about turning your java application into a 32bit one, but your post is "Proposed As Answer by enovac".  Other people also thanked you for your answer.  Can you clarify that, too?

    Thanks.


    Thursday, May 10, 2012 12:35 AM
  • I've been trying to connect to a MS Access 2007 database through JDBC. My JDK is JDK SE6 and OS is Windows 7 64-bit. But problem is I am unable to create a DSN  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."
    I have tried to install "AccessDatabaseEngine_X64" driver, but its throwing below error:
    You Cannot install the 64-bit MS Access Database Engine 2010 because you currently have 32-bit Office products installed.

    i am  dealing with this problem plz mail me the right method ashishgoel48@gmail.com




    • Edited by ASHISH8489 Tuesday, July 17, 2012 1:35 PM
    • Proposed as answer by Aidan6618 Thursday, October 11, 2012 8:30 PM
    • Unproposed as answer by Aidan6618 Thursday, October 11, 2012 8:30 PM
    Tuesday, July 17, 2012 1:30 PM
  • I'm not sure if anyone still has issues with this particular problem. I had this problem and just solved it with help of the above posts and some fiddling in netbeans7.1.2

    First off I have Windows 7 (64bit) and Office 2007 (32Bit - MS Access) and my program was running in 64Bit(if you don't know ... steps 2 and 3 below should clarify it)

    If you have a similar environment this should solve your problems ... hopefully

      • Go to Windows\SysWOW64\odbcad32.exe and run it. Add a System DSN (Driver is "Microsoft Access Driver (*.mdb)" in my case) and locate your DB (mine is    C:\DB.mdb for example) give it a name like "MyDSN1" or whatever you want to call it.
      • Open netbeans and click on Tools->Java Platforms. Once there click Add Platform (You need to add the Java JDK that's in Program Files(X86)/Java/jdk1.7..etc. If you don't have it you need to download the appropriate 32Bit JDK. Give it a name and click Finish.
      • Now right click on your program and select Properties. Under categories select Libraries and select the platform you just saved in the step above. Click OK and it should do some configuration etc.

        This is what I did to get my program working.

        As for the code I have ... it looks like the following for those of you - like me who are students and are a bit confused...
    String dbURL = "jdbc:odbc:MyDSN1";
    String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
    
    System.out.println("About to Load the JDBC Driver...");
    Class.forName(driverName);
    System.out.println("Driver Loaded Successfully...");
    
    System.out.println("About to get a connection....");
    Connection con = DriverManager.getConnection(dbURL, "","");
    System.out.println("Connection Successful...");
    

    Note: If you did not select/specify your DB path when you Added a System DSN you will need to specify the Driver connection string and DB file path as per normal.

    Hope this helps anyone coming accross this issue ... and is still struggling after the posts above.

    • Proposed as answer by marcocintra Tuesday, December 04, 2012 5:15 PM
    Thursday, October 11, 2012 9:02 PM
  • Thanks for the above solution. Now my program runs fine with 32bit Command Prompt.

    Many Thanks.

    Wednesday, December 26, 2012 5:31 PM