8.2.39 setReadOnly(boolean readOnly)
- Organization of this subsection
(1) Function
This method sets this Connection object in the read-only mode. The method sets the transaction access mode.
(2) Format
public synchronized void setReadOnly(boolean readOnly) throws SQLException
(3) Arguments
- boolean readOnly
-
Specify true to set the Connection object in the read-only mode; otherwise, specify false.
(4) Return value
None.
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
The Connection object is closed.
-
A transaction has already started.
-
A ResultSet object created by this Connection object with HOLD_CURSORS_OVER_COMMIT specified for holdability has not been closed.
(6) Notes
-
The transaction access mode is determined in the priority order described below. A smaller number represents a higher priority (for example, 1 has a higher priority than 2).
-
Transaction access mode specified with the setReadOnly method
-
Transaction access mode specified with the adb_clt_trn_access_mode system property
-
adb_clt_trn_access_mode property value specified in the info argument of the getConnection method of the DriverManager class
-
Value of adb_clt_trn_access_mode specified in the url argument of the getConnection method of the DriverManager class
-
-
In the case of the transaction access mode specified with the setReadOnly method, if the Connection object is pooled and then is reused, the previous transaction access mode is not inherited. This is the same status as when the setReadOnly method has not been executed.