Class AS400JDBCSavepoint
- java.lang.Object
-
- com.ibm.as400.access.AS400JDBCSavepoint
-
- All Implemented Interfaces:
- java.sql.Savepoint
public class AS400JDBCSavepoint extends java.lang.Object implements java.sql.Savepoint
The AS400JDBCSavepoint class is the Toolbox JDBC driver's representation of a savepoint. A savepoint is a point within the current transaction that can be referenced from the
Connection.rollback(savepoint)
method. When a transaction is rolled back to a savepoint, all changes made after the savepoint was created are undone.Savepoints can be either named or unnamed. The DB2 for IBM i does not support unnamed savepoints so internally the Toolbox JDBC driver will create a name to send to the system. The format is T_JDBCINTERNAL_n where 'n' is a counter that is incremented every time an unnamed savepoint is created.
Considerations:
- Named savepoints must be unique. A savepoint name cannot be reused until the savepoint is released, committed, or rolled back.
- Savepoints are valid only if autocommit is off. An exception is thrown is autocommit is enabled.
- Savepoints are not valid across XA connections. An exception is thrown if the connection is an XA connection.
- Savepoints require OS/400 V5R2 or IBM i. An exception is thrown if connecting to OS/400 V5R1 or earlier.
- If the connection option is set to keep cursors open after a traditional rollback, cursors also remain open after a rollback to a savepoint.
OS/400 V5R2 or IBM i is required to use savepoints. Savepoint support is new in modification 5 of the Toolbox JDBC driver.
-
-
Method Summary
Methods Modifier and Type Method and Description int
getSavepointId()
Returns the generated ID for the savepoint that this Savepoint object represents.java.lang.String
getSavepointName()
Returns the name for the savepoint that this Savepoint object represents.
-
-
-
Method Detail
-
getSavepointId
public int getSavepointId() throws java.sql.SQLException
Returns the generated ID for the savepoint that this Savepoint object represents.- Specified by:
getSavepointId
in interfacejava.sql.Savepoint
- Returns:
- the numeric ID of this savepoint.
- Throws:
java.sql.SQLException
- if this is a named savepoint.
-
getSavepointName
public java.lang.String getSavepointName() throws java.sql.SQLException
Returns the name for the savepoint that this Savepoint object represents.- Specified by:
getSavepointName
in interfacejava.sql.Savepoint
- Returns:
- the name of this savepoint.
- Throws:
java.sql.SQLException
- if this is an un-named savepoint.
-
-