• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Obtaining The SQL from a prepared Statement

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Prepared Statement

insert into person(firstname,lastname) values(?,?);

and I am setting the firstname and lastname via

Preparedstmt.set(1,"ade");
Preparedstmt.set(2,"yomi");

and the last step is Preparestmt.executeUpdate();

The question i have is i am trying to obtain the SQL executed against the Database,after doing the set and executing the executeUpdate command which method can i use?
 
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
I do not know any direct way to do this, but you can start for example SQL server profiler and monitor the statement that is going to be executed in the database.

Maybe you could enable logging in the JDBC driver level and see the prepared statement . to enable logging take a look at your driver manual and documenation.
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Ryan Bloom's logdriver.

Regards, Jan
 
reply
    Bookmark Topic Watch Topic
  • New Topic