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.

    Domanda

  • 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.
    martedì 17 agosto 2010 06:40

Risposte

Tutte le risposte

  • 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)
    martedì 17 agosto 2010 12:48
  • Thanks Paul 4 reply....

    MS Access is running on 32 bit.

     

    mercoledì 18 agosto 2010 07:33
  • 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)
    mercoledì 18 agosto 2010 17:09
  • Yes u r right.....I am doin database connectivity between JAVA n MS Access...

    Thanks

    mercoledì 18 agosto 2010 19:43
  • 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)
    mercoledì 18 agosto 2010 21:33
  • 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
    giovedì 19 agosto 2010 19:31
  • I also face same problem please anyone help me.my mail id is swasti092@gmail.com.
    giovedì 19 agosto 2010 20:23
  • 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)
    venerdì 20 agosto 2010 00:19
  • 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

    • Proposto come risposta enovac giovedì 11 novembre 2010 01:30
    venerdì 8 ottobre 2010 13:16
  • 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.

    • Proposto come risposta ASHUTOSH123 giovedì 18 novembre 2010 15:59
    giovedì 18 novembre 2010 15:59
  • 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.

    giovedì 17 febbraio 2011 04:36
  • 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?

    mercoledì 23 marzo 2011 23:28
  • 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!

    martedì 28 giugno 2011 19:40
  • Hi thrakkazz,

    Thank you so much for the solution :-)

     

    martedì 23 agosto 2011 01:04
  • Hi BobLarsen,

     

    May i know how you overcome this issue?

    Because i stuck on this errors.

    Please help on this error...

     

    • Proposto come risposta VirDeus domenica 9 ottobre 2011 04:44
    • Proposta come risposta annullata VirDeus domenica 9 ottobre 2011 04:44
    martedì 4 ottobre 2011 04:34
  • 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. :)


    • Modificato VirDeus domenica 9 ottobre 2011 04:47
    domenica 9 ottobre 2011 04:45
  • thanks, it's usefull for me...

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

    martedì 7 febbraio 2012 10:37
  • 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.




    • Modificato rathpl mercoledì 7 marzo 2012 04:51
    mercoledì 7 marzo 2012 04:45
  • :-) now it works...

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

    mercoledì 7 marzo 2012 04:58
  • 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

    giovedì 15 marzo 2012 13:57
  • 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.


    giovedì 10 maggio 2012 00:35
  • 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




    • Modificato ASHISH8489 martedì 17 luglio 2012 13:35
    • Proposto come risposta Aidan6618 giovedì 11 ottobre 2012 20:30
    • Proposta come risposta annullata Aidan6618 giovedì 11 ottobre 2012 20:30
    martedì 17 luglio 2012 13:30
  • 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.

    • Proposto come risposta marcocintra martedì 4 dicembre 2012 17:15
    giovedì 11 ottobre 2012 21:02
  • Thanks for the above solution. Now my program runs fine with 32bit Command Prompt.

    Many Thanks.

    mercoledì 26 dicembre 2012 17:31