Nonstop Database, HiRDB Version 9 UAP Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
For details and usage information about the methods provided by the PooledConnection interface, see the JDBC documentation. This section shows the PooledConnection interface methods that are supported by the JDBC driver.
- Organization of this subsection
- (1) Methods
- (2) Package and class names
(1) Methods
The following table lists the methods of the PooledConnection interface.
Table 18-60 PooledConnection interface methods
(a) getConnection()
- Function
- Establishes a physical connection when one is needed and returns a Connection object. There is a one-to-one correspondence between a Connection object and a physical connection with the HiRDB server.
- Format
public synchronized Connection getConnection() throws SQLException
- Arguments
- None.
- Return value
- Connection object
- Functional detail
- This method establishes a physical connection when one is needed and returns a Connection object. There is a one-to-one correspondence between a Connection object and a physical connection with the HiRDB server. Once established, a physical connection is not closed until this class object is closed. This class object maintains the physical connection even if the close method is executed on the Connection object. This physical connection can then be used again the next time a connection request is issued by calling this method (the wait time specified in setLoginTimeout or the PDCONNECTWAITTIME client environment definition does not apply).
- Exceptions
- The JDBC driver throws an SQLException in the following cases:
- A database access error occurred.
- Specified connection information is invalid.
(b) addConnectionEventListener(ConnectionEventListener listener)
- Function
- Registers a specified event listener so that events that occur in this PooledConnection object will be reported.
- Format
public synchronized void addConnectionEventListener(ConnectionEventListener listener)
- Arguments
- ConnectionEventListener listener
- Component that implements the ConnectionEventListener interface, so that if the connection is closed or an error occurs, that event will be reported. Normally, this is a connection pool management program.
- Return value
- None.
- Functional detail
- This method registers a specified event listener so that events that occur in this PooledConnection object will be reported. If the listener to be added is null, this method does not register a listener.
- This driver's method cannot be called from the event listener registered by the addConnectionEventListener method. If an attempt is made to call the driver's method, the driver might stop responding (due to a deadlock).
- Exceptions
- None.
(c) close()
- Function
- Closes the physical connection.
- Format
public synchronized void close()
- Arguments
- None.
- Return value
- None.
- Functional detail
- This method closes the physical connection for all pooled connections. The method attempts to close the physical connection by executing PooledConnection.close() even if a Connection object has been acquired and the database is being accessed.
- Exceptions
- None.
(d) removeConnectionEventListener(ConnectionEventListener listener)
- Function
- Deletes from the component list a specified event listener that reports on events that occur in this PooledConnection object.
- Format
public synchronized void removeConnectionEventListener(ConnectionEventListener listener)
- Arguments
- ConnectionEventListenerlistener
- Component registered as a listener by implementing the ConnectionEventListener interface. Normally, this is a connection pool management program.
- Return value
- None.
- Exceptions
- None.
(2) Package and class names
The names of the package and class for using this interface directly are as follows:
- Package name: JP.co.Hitachi.soft.HiRDB.JDBC
- Class name: PrdbPooledConnection
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.