我正在使用p6spy来记录我的程序生成的sql语句.输出的spy.log文件的格式如下所示:
current time|execution time|category|statement SQL String|effective SQL string
Run Code Online (Sandbox Code Playgroud)
我只是想知道是否有人知道是否有办法改变spy.properties文件并且只有最后一列,即有效的SQL字符串,输出到spy.log文件?我查看了属性文件,但没有找到任何似乎支持这个的东西.
谢谢!
我正在尝试连接数据库并使用java程序中的预处理语句更新其中的表 - 数据库称为"数据库",并且还有另一个名为Views的文件夹,其中表("TABLE")表示我正在尝试更新.这是我的代码:
public void updateTable(Map<String, String> mp) throws SQLException {
String URL = "jdbc:oracle:thin:@localhost:1500:orcl";
String USER = "user";
String PASS = "password";
Connection con = DriverManager.getConnection(URL, USER, PASS);
PreparedStatement updateTableName = null;
String updateString =
"update database.Views.TABLE " +
"set TABLENAME = ? " +
"where TABLENAME = ?";
try {
con.setAutoCommit(false);
updateTableName = con.prepareStatement(updateString);
for (Map.Entry<String, String> e : mp.entrySet())
{
updateTableName.setString(1, e.getValue());
updateTableName.setString(2, e.getKey());
updateTableName.executeUpdate();
con.commit();
}
} catch (SQLException e) {
if (con != null)
{ …Run Code Online (Sandbox Code Playgroud)