This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes PreparedStatement and above 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 "PreparedStatement and above" Watch "PreparedStatement and above" New topic

PreparedStatement and above

Manoj Pooleery
Ranch Hand

Joined: Sep 20, 2000
Posts: 35
Hi All,
I want to see the SQL statement inside a PreparedStatement just before it is executed. (After the values have been set). Anybody got any idea as to how to display it?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
It doesn't work that way. The PreparedStatement is sent to the database prior to having the variables loaded for precompiling. The variables are then sent for execution. JDBC doesn't replace the question marks with your variables. That is happening at the database.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Have you checked out Aspose?
subject: PreparedStatement and above
It's not a secret anymore!