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 #115 background imageLoading...
Page #115 background image
Disconnecting from data sources in JDBC applications
When you have finished with a connection to a data source, it is essential that you
close the connection to the data source. Doing this releases the Connection object’s
database and JDBC resources immediately.
To close the connection to the data source, use the close method. For example:
Connection con;
...
con.close();
For a connection to a DB2 data source, if autocommit mode is not on, the
connection needs to be on a unit-of-work boundary before you close the
connection.
For a connection to an IBM Informix Dynamic Server database, if the database
supports logging, and autocommit mode is not on, the connection needs to be on a
unit-of-work boundary before you close the connection.
Related concepts
“Example of a simple JDBC application” on page 7
“JDBC connection objects” on page 19
“How JDBC applications connect to a data source” on page 9
Related tasks
“Committing or rolling back JDBC transactions” on page 74
Chapter 3. JDBC application programming 99

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