java.sql.SQLException: ODBC Driver Manager
SruthiJan 10 2012 — edited Jan 10 2012Hi,
I am new to JSP & Web tech. I am trying to access SQL server from validation.jsp. The piece of code used for the same is given below. TestDSN is the System DSN I have added in ODBC Data Source Administrator(All Control Panel Items\Administrative Tools). I am using Tomcat 7.
---------------------------------------------------------------------------------------------------------------------------
<%
String user=request.getParameter("t1");
String pass=request.getParameter("t2");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection test=DriverManager.getConnection("jdbc:odbc:TestDSN","sa","abcd");
Statement st=test.createStatement();
String sqlQuery = "Select username,password from dbo.userlog where username=\'" + user + "\'";
ResultSet rs=st.executeQuery( sqlQuery );
int userflag = 0;
---------------------------------------------------------------------------------------------------------------------------
I am able to access database and do the validation and get the direction to next page in my 32 bit PC (Windows 7). But while trying the same from 64 bit PC, the following message is thrown *"Error occurred java.sql.SQLException: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application"*
Could you please help me.
Thank you.
Sruthi