• 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

PreparedStatment Logging

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please can someone tell me how to print out (or log via log 4j) the preparedstatment sent through JDBC.

If I have a java.sql.Statement object which uses a query like:
select name from company where sector = 'USA'
then I can print out this entire query to my log file every time it is executd.

If I have a preparedStatement like:
select name from company where sector = ?

Then when I print the sql I get "select name from company where sector = ?
"
But I want to be able to see what has binded to the ? parameter marker at runtime.

Any ideas?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its always worth searching the forum before posting. Your question may have already been answered.
reply
    Bookmark Topic Watch Topic
  • New Topic