Get query from java.sql.PreparedStatement [duplicate]
This is nowhere definied in the JDBC API contract, but if you’re lucky, the JDBC driver in question may return the complete SQL by just calling PreparedStatement#toString(). I.e. System.out.println(preparedStatement); To my experience, the ones which currently do so are at least the PostgreSQL 8.x and MySQL 5.x JDBC drivers. In the case that your JDBC … Read more