It's not a secret anymore!
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
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: 1138

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.
I agree. Here's the link:
subject: Viewing SQL from PreparedStatements
jQuery in Action, 3rd edition