Closing The Connection To A Data Source In An Sqlj Application - IBM DB2 Manual

Table of Contents

Advertisement

Closing the connection to a data source in an SQLJ application

When you have finished with a connection to a data source, you need to close the
connection to the data source. Doing so releases the connection context object's
DB2 and SQLJ resources immediately.
To close the connection to the data source, use one of the ConnectionContext.close
methods.
v If you execute ConnectionContext.close() or
v If you execute ConnectionContext.close(ConnectionContext.KEEP_CONNECTION)
The following code closes the connection context, but does not close the connection
to the data source.
...
ctx = new EzSqljctx(con0);
...
156
Application Programming Guide and Reference for Java
ConnectionContext.close(ConnectionContext.CLOSE_CONNECTION), the connection
context, as well as the connection to the data source, are closed.
the connection context is closed, but the connection to the data source is not.
EzSqljctx.close(ConnectionContext.KEEP_CONNECTION);
Related concepts
"Example of a simple SQLJ application" on page 101
Related tasks
"Connecting to a data source using SQLJ" on page 103
// Create a connection context object
// from JDBC connection con0
// Perform various SQL operations
// Close the connection context but keep
// the connection to the data source open

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents