1

I created a PreparedStatementWrapper object containing an INSERT statement. Now I would like to print my object. I want to test my INSERT statement, to see that it is correct. How can I do that?

Leigh
  • 28,605
  • 10
  • 52
  • 98

1 Answers1

0

Just use System.out.println() and toString() method before you execute it.

PreparedStatement ps = con.prepareStatement(QUERY);
ps.setString(1, "Test");
System.out.println(ps.toString());

EDIT: It works only if you are using MYSQL driver.

Simon Dorociak
  • 33,095
  • 10
  • 66
  • 104