Unanswered: How to get the Query string from executeQuery()?
I am implementing a wrapper for a specific JDBC driver and have the following question. In the executeQuery() method in PreparedStatement, I need to do some crazy stuff with the query before executing it. How do I get a hold of the actual String representing the query ? Obviously the Statement has the String somewhere, but I just cant figure out how to get a hold of it.
If you are using a PreparedStatement object then you will not be able to access the SQL string because the PreparedStatement represents a precompiled SQL statement. There are no methods to access the string, even if the JDBC driver doesn't send the statement to the server for precompilation.
The only way to manipulate the SQL statement is through the PreparedStatement setXXX() methods to bind the values of any parameters in the statement.