Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

prepared statement in java

 
kshitiz khandelwal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String query = "SELECT * FROM pdt1 WHERE pid = ? , pname = ?";
PreparedStatement ps = con.prepareStatement(query);
ps.setInt(1, 5);
ps.setString(2,"Xyz");
System.out.println("ps.set executed");

ResultSet rs = ps.executeQuery();// exception occurs here.


output:

Exception in thread "main" java.sql.SQLException: ORA-00933: SQL command not properly ended
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably meant to use "AND" instead of the comma; that would make it proper SQL.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic