代码如下: PreparedStatement ps = conn.prepareStatement(sql); String sqlText = ((JDBC4PreparedStatement)ps).asSql();