• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

PreparedStatement

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a code in java to connect to JDBC

in that..

PreparedStatement ps=connection.prepareStatement("select * from table_1 where id=?");
ps.setInt(1,1);
ps.executeUpdate();



When will be the value 1 gets substituted into the statement? How can I get the query as "Select * from table_1 where id=1"....

This will be useful if I want to list the individual queries that are invoked.... Can anyone help me on this? thanks
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gurumurthy,
Parameters are set before it sends the statement to database server to execute, although I think it checks several kind of possible problems like type matching and ... before doing so.

It is not simply possible to view what is final statement that prepared statements are going to send to database from java side without additional tools.

You can try to find some profiler in ORACLE side and view what is statement that arrives to ORACLE or you may use some kind of mediator like LogDriver available in http://rkbloom.net/logdriver/ .
 
reply
    Bookmark Topic Watch Topic
  • New Topic