How to see PreparedStatement's SQL string?
java, jdbc, prepared-statement
Solution
The easiest way (that works with any JDBC driver) is to use log4jdbc. It's a proxy that wraps the driver, creates a readable SQL string by combining the SQL and its parameters and logs it, then passes the SQL and parameters on to the underlying driver.
Problem
When we create a PreparedStatement we use '?' chars to then be replaced by setted parameters. How can we see the final SQL string after these parameters are set?