Java JDBC savePoint

前端 未结 2 1048
南笙
南笙 2020-12-30 10:44

Reading

http://download.oracle.com/javase/6/docs/api/java/sql/Savepoint.html

it is not well spelled out what savepoints are mapped from database perspective.

相关标签:
2条回答
  • 2020-12-30 11:24

    Savepoints are not a JDBC feature, they are a DBMS feature.

    In addition to Luke's detailed answer you might also want to read up on what the DBMS manuals explain about savepoints

    http://www.postgresql.org/docs/current/static/sql-savepoint.html
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_10001.htm#BABFIJGC
    http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0003271.html
    http://msdn.microsoft.com/en-us/library/ms188378.aspx
    http://dev.mysql.com/doc/refman/5.5/en/savepoint.html

    0 讨论(0)
  • 2020-12-30 11:25

    A savepoint marks a point that the current transaction can roll back to. Instead of rolling all of its changes back, it can choose to roll back only some of them. For example, suppose you:

    • start a transaction,
    • insert 10 rows into a table,
    • set a savepoint,
    • insert another 5 rows,
    • rollback to the savepoint,
    • commit the transaction.

    After doing this, the table will contain the first 10 rows you inserted. The other 5 rows will have been deleted by the rollback.

    Setting a savepoint doesn't 'save' any data to the database. It doesn't make database changes visible to any other transaction. A savepoint is just a marker that the current transaction can roll back to.

    0 讨论(0)
提交回复
热议问题