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

PreparedStatment Logging

 
Gobind Singh
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its always worth searching the forum before posting. Your question may have already been answered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic