aspose file tools*
The moose likes JDBC and the fly likes The specified DSN contains an architecture mismatch between the Driver and Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "The specified DSN contains an architecture mismatch between the Driver and Application" Watch "The specified DSN contains an architecture mismatch between the Driver and Application" New topic
Author

The specified DSN contains an architecture mismatch between the Driver and Application

Kv Payal
Greenhorn

Joined: Apr 17, 2011
Posts: 11
Hi,

I am trying to execute a jdbc program to read data from MS Excel(I have Microsoft Excel Starter 2010) on Windows 7, 64bit operating system.

I created a system DSN(and also tried with UserDSN) the following program and it is throwing the exception :

Exception: [Microsoft][ODBC Driver Manager] : The specified DSN contains an architecture mismatch between the Driver and Application

Program
//import java.io.*;
import java.sql.*;
public class ExcelReadTest{
public static void main(String[] args){
// Connection connection = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbcdbc:test2" );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );

ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();


while (rs.next()) {
for (int i = 1; i <= numberOfColumns; i++) {
if (i > 1) System.out.print(", ");
String columnValue = rs.getString(i);
System.out.print(columnValue);
}
System.out.println("");
}

st.close();
con.close();
} catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}
}
}

Note :I used c:\windows\sysWOW64\odbcad32.exe to create a data source that connects to a 32-bit driver under 64-bit platform,. I also tried c:\windows\system32\odbcad32.exe to connect a 64-bit driver but there was no driver for MS Excel. Only driver for SQL Server was available

Can somebody please help me to run the jdbc program in windows 7 and let me know what drivers do I need to use and how?

Thanks in advance.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Can you check this thread:
http://www.coderanch.com/t/533801/JDBC/java/error-connect-java-ms-access

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Brad Thiru
Greenhorn

Joined: Mar 14, 2013
Posts: 2
Hi,

I'm also facing the same issue when my system recently got upgraded to Windows 7 64 bit. I've tried setting up of DSN via C:\Windows\SysWOW64\odbcad32.exe. But i'm getting the same error msg. I got bit struck. If anyone has any solution, Please do share the same.

Thanks,
Brad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The specified DSN contains an architecture mismatch between the Driver and Application