Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

java.sql.SQLException: ODBC Driver Manager

SruthiJan 10 2012 — edited Jan 10 2012
Hi,

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

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 7 2012
Added on Jan 10 2012
3 comments
464 views