How to start a transaction in JDBC?

后端 未结 8 1117
梦谈多话
梦谈多话 2020-12-02 08:48

Connection.setTransactionIsolation(int) warns:

Note: If this method is called during a transaction, the result is implementation-defined.

8条回答
  •  眼角桃花
    2020-12-02 09:40

    You can use these methods for transaction:

    1. you must create the connection object like con
    2. con.setAutoCommit(false);
    3. your queries
    4. if all is true con.commit();
    5. else con.rollback();

提交回复
热议问题