LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2115|回复: 0

postgresql自动commit的问题

[复制链接]
发表于 2010-5-31 15:56:42 | 显示全部楼层 |阅读模式
系统是用java写的,我写程序时忘了写 conx.commit(),但执行时没有报错,并且数据还是被删除了,这是怎么回事?

Connection conx=cons.Connect();
            Statement stmt=conx.createStatement();
            conx.setAutoCommit(false);
            stmt.executeUpdate(strSql1);
            stmt.executeUpdate(strSql2);
            stmt.executeUpdate(strSql3);
            stmt.executeUpdate(strSql4);
            stmt.executeUpdate(strSql5);
            stmt.executeUpdate(strSql6);
            stmt.executeUpdate(strSql7);
            stmt.executeUpdate(strSql);
            stmt.close();
            conx.setAutoCommit(true);
            conx.close();
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表