| Author |
Error while using PreparedStatement
|
Divya U.S
Greenhorn
Joined: Jul 11, 2007
Posts: 1
|
|
Hello, I am using netbeans 5.5 and SQL2000 server db. following error is coming java.sql.SQLException: Driver does not support this function at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:115) my code is given below. try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc dbc:MyDataSource","sa","sajandev"); char[] pass=TxtPass.getPassword(); String passwd=new String(pass); this.TxtUser.getText() + "' " + and UserPass="'+ passwd ; String str="select * from UserLogin where UserId=? and UserPass=?"; PreparedStatement ps=con.prepareStatement(str); String user=this.TxtUser.getText(); ps.setString(1,user); ps.setString(2,passwd); lblMsg.setText(str); ResultSet rs=ps.executeQuery(str); str=""; if(rs.next()) { lblMsg.setText("Login Successful!!"); } else { lblMsg.setText("Login Failes!!"); } con.close(); rs.close(); ps.close(); } catch(Exception e) { System.out.println("SQL Exception: "+ e.toString()); e.printStackTrace(); } Please give me a solution for this as soon as possible. I've to create an application submission date is Aug 2. pls help me... divya
|
 |
subodh gupta
Ranch Hand
Joined: Jul 23, 2007
Posts: 203
|
|
|
just write ps.executeQuery(); without any argument your code will run.
|
http://subodh-gupta.blogspot.com
|
 |
 |
|
|
subject: Error while using PreparedStatement
|
|
|