Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

17.4.2 Connection interface

Organization of this subsection
(1) Overview
(2) Methods
(3) Package and class names
(4) Notes

(1) Overview

The Connection interface provides the following principal functions:

(2) Methods

Table 17-8 lists the methods of the Connection interface. This interface does not support methods that are not listed in the table. If an unsupported method is specified, the interface throws an SQLException.

Table 17-8 Connection interface methods

Method Remarks
clearWarnings() --
close() During a normal connection, this method releases the connection with the database. When a connection pool is used or during an XA connection, this method does not physically disconnect the connection.
If an error occurs during close method execution, the method does not throw an SQLException.
If a fatal error occurs during close method execution when a connection pool or an XA connection is being used and use of the connection pool becomes disabled, a connectionErrorOccurred method of the ConnectionEventListener class does not occur.
commit() Even if this method is called while the AUTO commit mode is still effective, the interface executes commit processing without throwing an exception.
createStatement() --
createStatement(int resultSetType, int resultSetConcurrency) If TYPE_SCROLL_SENSITIVE is specified as the result set type, the JDBC driver switches to TYPE_SCROLL_INSENSITIVE and sets an SQLWarning.
The only concurrent processing type that the JDBC driver supports is CONCUR_READ_ONLY. If CONCUR_UPDATABLE is specified, the JDBC driver switches to CONCUR_READ_ONLY and sets an SQLWarning.
createStatement(int resultSetType,int resultSetConcurrency, int resultSetHoldability) Same as above for the resultSetType and resultSetConcurrency arguments.
getAutoCommit() --
getCatalog() Returns the null value.
getHoldability() --
getMetaData() --
getTransactionIsolation Always returns TRANSACTION_REPEATABLE_READ.
getTypeMap() Returns a free map.
getWarnings() --
isClosed() --
isReadOnly() Always returns false.
prepareStatement(String sql) --
prepareStatement(String sql, int resultSetType, int resultSetConcurrency) If TYPE_SCROLL_SENSITIVE is specified as the result set type, the JDBC driver switches to TYPE_SCROLL_INSENSITIVE and sets an SQLWarning.
The only concurrent processing type that the JDBC driver supports is CONCUR_READ_ONLY. If CONCUR_UPDATABLE is specified, the JDBC driver switches to CONCUR_READ_ONLY and sets an SQLWarning.
prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Same as above for the resultSetType and resultSetConcurrency arguments.
rollback() --
setAutoCommit(boolean autoCommit) If this method is called in the middle of a transaction, that transaction is not committed.
setCatalog(String catalog) This specification is ignored.
setHoldability(int holdability) --
setReadOnly(boolean readOnly) This specification is ignored.
setTransactionIsolation(int level) This specification is ignored.
checkSession(int waittime) This method is specific to the JDBC driver.
For details, see (a) checkSession.

Legend:
--: None
(a) checkSession

Function
Checks the current connection status.

Format
 
public int checkSession (int waittime) throws SQLException
 

Argument
int waittime:
Specifies the wait time (in seconds). If 0 is specified, the JDBC driver waits until the time specified by the PDCWAITTIME client environment definition.

Return value
PrdbConnection.SESSION_ALIVE:
The method was able to confirm that a connection is currently established.
PrdbConnection.SESSION_NOT_ALIVE:
Because of a cause other than a timeout within the time specified in the argument, the method was unable to confirm that a connection is currently established.
PrdbConnection.SESSION_CHECK_TIMEOUT:
Because of a timeout within the time specified in the argument, the method was unable to confirm that a connection is currently established.

Functional detail
Checks the current connection status.

Exception that occurs
If the wait time specification value is -1 or less, the JDBC driver throws a java.sql.SQLException.

(3) Package and class names

The names of the package and class for installing this interface are as follows:

Package name: JP.co.Hitachi.soft.HiRDB.JDBC

Class name: PrdbConnection

(4) Notes

(a) Holdability specification

If holdability is specified with one of the methods shown below, the HIRDB_CURSOR specification value in either the URL syntax or the properties can be overwritten for each Statement object (Statement or PreparedStatement object) and Connection object:

For ResultSet and DatabaseMetaData objects (when the setHoldability method is used) generated by the applicable method, the holdability specifications that become effective change depending on the combinations of these specifications and the HIRDB_CURSOR specifications.

Table 17-9 shows the holdability specifications that become effective for Statement objects generated by the following methods:

 

Table 17-9 Effective holdability specifications (1/2)

HIRDB_CURSOR or setHiRDBCursorMode specification Specification value of resultSetHoldability argument
ResultSet.
HOLD_CURSORS_OVER_COMMIT
ResultSet.
CLOSE_CURSORS_AT_COMMIT
Execution of SELECT statement with UNTIL DISCONNECT specified Execution of other SQL statement
TRUE specified for HIRDB_CURSOR in properties TRUE specified for HIRDB_CURSOR in URL syntax T T F
FALSE specified for HIRDB_CURSOR in URL syntax T T F
FALSE specified for HIRDB_CURSOR in properties TRUE specified for HIRDB_CURSOR in URL syntax T T F
FALSE specified for HIRDB_CURSOR in URL syntax T T F
true specified for setHiRDBCursorMode T T F
false specified for setHiRDBCursorMode T T F

Legend:
T: The JDBC driver operates as if TRUE were specified for HIRDB_CURSOR.
F: The JDBC driver operates as if FALSE were specified for HIRDB_CURSOR.

Table 17-10 shows the holdability specifications that become effective for Statement or DatabaseMetaData objects generated by methods other than the Table 17-9 methods.

Table 17-10 Effective holdability specifications (2/2)

HIRDB_CURSOR or setHiRDBCursorMode specification Specification value of setHoldability method No execution of setHoldability method
ResultSet.
HOLD_CURSORS_OVER_COMMIT
ResultSet.
CLOSE_CURSORS_AT_COMMIT
Execution of SELECT statement with UNTIL DISCONNECT specified Execution of other SQL statement Execution of SELECT statement with UNTIL DISCONNECT specified Execution of other SQL statement
TRUE specified for HIRDB_CURSOR in properties TRUE specified for HIRDB_CURSOR in URL syntax T T F T T
FALSE specified for HIRDB_CURSOR in URL syntax T T F T F
FALSE specified for HIRDB_CURSOR in properties TRUE specified for HIRDB_CURSOR in URL syntax T T F T T
FALSE specified for HIRDB_CURSOR in URL syntax T T F T F
true specified for setHiRDBCursorMode T T F T T
false specified for setHiRDBCursorMode T T F T F

Legend:
T: The JDBC driver operates as if TRUE were specified for HIRDB_CURSOR.
F: The JDBC driver operates as if FALSE were specified for HIRDB_CURSOR.

For details about HIRDB_CURSOR, see 17.2.2 Connecting to HiRDB with the getConnection method.