• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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( "jdbc:odbc: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.
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you check this thread:
https://coderanch.com/t/533801/JDBC/java/error-connect-java-ms-access

Regards, Jan
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic