File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Viewing SQL from PreparedStatements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Viewing SQL from PreparedStatements" Watch "Viewing SQL from PreparedStatements" New topic

Viewing SQL from PreparedStatements

Ben Klug
Ranch Hand

Joined: Jan 28, 2002
Posts: 45

is there a way to view the SQL-Statement that was created from a PreparedStatement? I'd like to view it filled with parameters instead of ?'s for debug reasons.

Thanks, b.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You almost answered your own question
Search for DebuggableStatement
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Perhaps P6 Spy will be of help.

Were you referring to the JavaWorld article entitled Overpower the PreparedStatement?

Good Luck,
[ February 14, 2005: Message edited by: Avi Abrami ]
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

That's the one. I've found it very useful many times.
It is sorta covered in the JavaRanch Style Guide.
subject: Viewing SQL from PreparedStatements
It's not a secret anymore!