Debugging PreparedStatement
1) Using a Debug package that developed by java underground: Connection con = DriverManager.getConnection(url); DebugLevel debug = DebugLevel.ON; String sql = "SELECT name,rate FROM EmployeeTable WHERE rate > ?"; //Use a factory instead of Connection to get a PreparedStatement. //PreparedStatement ps = con.prepareStatement(sql); PreparedStatement ps = StatementFactory.getStatement(con,sql,debug); ps.setInt(1,25); //If ps is a DebuggableStatement, you see the statement, //otherwise, an object identifier is displayed System.out.println(" debuggable statement= " + ps.toString()); Reference: http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html?page=3 Download the source code: http://www.javaworld.com/javaworld/jw-01-2002/overpower/jw-0125-debug.zip 2) Using LOG4J: log4j.rootLogger=DEBUG, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.std...