使用sybase jdbc driver得到connection conn,多次使用conn.setAutoCommit(b),b 为相同的true|false时,报错SET CHAINED command not allowed within multi-statement transaction.
解决方法:
使用
if (conn.getAutoCommit()!=b) {
conn.setAutoCommit(b);
}
代替
conn.setAutoCommit(b).
使用其它数据库(如oracle)没有这个问题.
解决方法:
使用
if (conn.getAutoCommit()!=b) {
conn.setAutoCommit(b);
}
代替
conn.setAutoCommit(b).
使用其它数据库(如oracle)没有这个问题.
博客指出使用Sybase JDBC Driver获取连接后,多次以相同值设置自动提交会报错。给出的解决办法是先判断当前自动提交状态,若与要设置的值不同再进行设置。同时提到使用其他数据库如Oracle无此问题。
991

被折叠的 条评论
为什么被折叠?



