我需要一种方法来查看从我的 Java 程序发送到 PostgreSQL 的查询。我正在使用c3p0JDBC 连接池来获取连接。当我toString在 PreparedStatement 上使用方法时,它给了我
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement@577b57a3 
我的代码:
public void readData1() {
    Connection con = null;
    try
    {
        con = DatabaseFactory.getInstance().getConnection();
        con.setAutoCommit(false);
        java.sql.Timestamp ts= new java.sql.Timestamp(new java.util.Date().getTime());
        String query= "INSERT INTO TEST_DATA values(?,?,?)";
        PreparedStatement stmt = con.prepareStatement(query);
        stmt.setDate(1,new java.sql.Date(System.currentTimeMillis()));
        stmt.setInt(2, 100);
        stmt.setTimestamp(3,ts );
        System.out.println(stmt.toString());
        stmt.executeUpdate();
        con.commit();
        stmt.close();
    }
    catch (Exception e)
    {
        System.out.println("Could not read from DB, error: "+e.getMessage());
        e.printStackTrace();
    }
    finally
    {
        try { con.close(); } catch (Exception e) {}
    }
}
有人可以帮我如何从 PreparedStatement 获取 sql 查询吗?
谢谢