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 #35 background imageLoading...
Page #35 background image
JDBC connection objects
When you connect to a data source by either connection method, you create a
Connection object, which represents the connection to the data source.
You use this Connection object to do the following things:
v Create Statement, PreparedStatement, and CallableStatement objects for
executing SQL statements. These are discussed in Executing SQL statements in
JDBC applications.
v Gather information about the data source to which you are connected. This
process is discussed in Learning about a data source using DatabaseMetaData
methods.
v Commit or roll back transactions. You can commit transactions manually or
automatically. These operations are discussed in Commit or roll back a JDBC
transaction.
v Close the connection to the data source. This operation is discussed in
Disconnecting from data sources in JDBC applications.
Related concepts
“JDBC interfaces for executing SQL” on page 24
Related tasks
“Disconnecting from data sources in JDBC applications” on page 99
“Committing or rolling back JDBC transactions” on page 74
“Learning about a data source using DatabaseMetaData methods” on page 21
“Setting the isolation level for an SQLJ transaction” on page 153
Related reference
IBM Data Server Driver for JDBC and SQLJ isolation levels” on page 73
Creating and deploying DataSource objects
JDBC versions starting with version 2.0 provide the DataSource interface for
connecting to a data source. Using the DataSource interface is the preferred way to
connect to a data source.
Using the DataSource interface involves two parts:
v Creating and deploying DataSource objects. This is usually done by a system
administrator, using a tool such as WebSphere Application Server.
v Using the DataSource objects to create a connection. This is done in the
application program.
This topic contains information that you need if you create and deploy the
DataSource objects yourself.
The IBM Data Server Driver for JDBC and SQLJ provides the following DataSource
implementations:
v com.ibm.db2.jcc.DB2SimpleDataSource, which does not support connection
pooling. You can use this implementation with IBM Data Server Driver for JDBC
and SQLJ type 2 connectivity or IBM Data Server Driver for JDBC and SQLJ
type 4 connectivity.
v com.ibm.db2.jcc.DB2ConnectionPoolDataSource, which supports connection
pooling. You can use this implementation with IBM Data Server Driver for JDBC
and SQLJ type 2 connectivity or IBM Data Server Driver for JDBC and SQLJ
type 4 connectivity.
Chapter 3. JDBC application programming 19

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