ODBC Connection with DSN in Eclipse
987372Jan 27 2013 — edited Jan 14 2015Hello.
I've been trying to connect to a MS Excel 2007 database through JDBC. My JRE is 32-bit and OS is Windows 7 64-bit.I am running the java code through eclipse. But problem is I am unable to create a DSN using Windows\system32\odbcad32.exe because it doesn't show ODBC drivers for MS Excel at all, it's only showing drivers for MS SQL Server.
When tried to click on Configure for "MS Excel Database" (which is an already created DSN, I guess), it first shows error message : "The setup routines for the Microsoft Excel Drivers (*.xls, *.xlsx,....) 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 forum.
The odbcad32.exe in Windows\SysWOW64 does let me create a DSN for MS Excel, 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.
P.S : Please give a solution for this .I am very frustrated for this as i am searching the solution in different forums but unable to get the solution.
Edited by: 984369 on Jan 27, 2013 9:42 AM