EasyManuals Logo

IBM DB2 User Manual

IBM DB2
585 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #172 background imageLoading...
Page #172 background image
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
ConnectionContext.close(ConnectionContext.CLOSE_CONNECTION), the connection
context, as well as the connection to the data source, are closed.
v If you execute ConnectionContext.close(ConnectionContext.KEEP_CONNECTION)
the connection context is closed, but the connection to the data source is not.
The following code closes the connection context, but does not close the connection
to the data source.
...
ctx = new EzSqljctx(con0); // Create a connection context object
// from JDBC connection con0
... // Perform various SQL operations
EzSqljctx.close(ConnectionContext.KEEP_CONNECTION);
// Close the connection context but keep
// the connection to the data source open
Related concepts
“Example of a simple SQLJ application” on page 101
Related tasks
“Connecting to a data source using SQLJ” on page 103
156 Application Programming Guide and Reference for Java

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM DB2 and is the answer not in the manual?

IBM DB2 Specifications

General IconGeneral
DeveloperIBM
Initial Release1983
LicenseProprietary
Written inC, C++
CategoryDatabase Management System (RDBMS)
Operating SystemLinux, Windows
Programming LanguagesC, C++
Data ModelsRelational
EditionsCommunity, Standard, Advanced
Key Featureshigh availability, scalability