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.
When savepoints are set, are the database changes made available to other transactions?
Thanks
An SQL savepoint represents the state of data and schemas at a particular point in time within a unit of work. You can use SQL statements to set a savepoint, release a savepoint, and restore data and schemas to the state that the savepoint represents.
A SAVEPOINT is a point in a transaction in which you can roll the transaction back to a certain point without rolling back the entire transaction. Syntax for Savepoint command: SAVEPOINT SAVEPOINT_NAME; This command is used only in the creation of SAVEPOINT among all the transactions.
A SAVEPOINT is a marker within a transaction that allows for a partial rollback. As changes are made in a transaction, we can create SAVEPOINTs to mark different points within the transaction. If we encounter an error, we can rollback to a SAVEPOINT or all the way back to the beginning of the transaction.
After a savepoint has been created, you can either continue processing, commit your work, roll back the entire transaction, or roll back to the savepoint.
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:
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With