应该是根据对应的connection进行操作吧。

解决方案 »

  1.   

    PreparedStatment准备一个语句,connection才是连接事务。
      

  2.   

    .....
    conn.setAutoCommit(false);
    PreparedStatment pstmt = conn.prepareStatement(strSQL);
    pstmt.setXxx(...);
    pstmt.execute()
    conn.commit();
    ....
      

  3.   

    还是一样的,把自动提交设置为false,然后把执行事务语句execute(),最后再commit
      

  4.   

    try{
    connection.setAutoCommint(false);
                            // 代码 用PreparedStatement  性能比Statementh好.                        connection.commit();
                            connection.setAutoCommit(true);
       }
               catch(SQLException e){
                       }
                       finally{
    //代码
    if(connection!=null){
       connection.close();
    }
          }