Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Debug a PreparedStatement

807569May 31 2006 — edited May 31 2006
Hi,

I have a PreparedStatement like for example this:
Connection con = getConnection();
String sql = "SELECT * FROM table WHERE name = ? AND age = ?";
PreparedStatement stmt = con.prepareStatement();
// Setting data in the prepared statement...
I would like to print out the query that is to be executed, with the ? replaced by the data I set. Anybody know how to do this?

Both getMetaData and getParameterMetaData generated an error saying it was an invalid operation.

Thnaks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2006
Added on May 31 2006
7 comments
1,483 views