Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check query within PreparedStatement object

 
Vijay Arora
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PreparedStatement pst=connection.prepareStatement("Select * from table where name=? and age=?");
pst.setString(1,"VIJAY");
pst.setInt(2,20);
ResultSet rs=pst.executeQuery();

Is there any method to print the query string replaced by name and age values.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49405
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your displayed name against the JavaRanch naming policy and amend it accordingly. It requires first name-space-last name.
 
suresh charan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the following article

http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html?page=1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic