Skip Headers
Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

JDBC Connection Pools

A JDBC connection pool is a collection of reusable database connections that service a single application. This section introduces the following topics and techniques for working with JDBC connection pools:

Default Connection Pools

OracleAS TopLink provides a default internal connection pool for sessions that use a server session for database access. The default settings are appropriate for most applications; however, you can modify the connection pool attributes in the sessions.xml file to tailor the pool to your needs. You can specify:

  • The type of connection in the connection pool (read or write)

  • The name of the connection pool

  • The maximum number of database connections available in the connection pool

  • The minimum number of database connections available in the connection pool

For complete information on specifying the internal connection pool in the sessions.xml file, see "connection-pool Element".

External Connection Pools

With OracleAS TopLink you can use an external connection pool rather than the default internal pool, enabling you to leverage external transaction management systems such as JTA. This is common in applications that incorporate an application server.

To use an external connection pool, enable and specify it as follows:

  • If your application uses EJB entity beans, modify the toplink-ejb-jar.xml file, using the elements described in Table 9-1, "login Elements".

  • If your application does not leverage EJB entity beans, configure the external connection pool in the sessions.xml file, using the elements described in "connection-pool Element".

JDBC Datasources

OracleAS TopLink uses a datasource to access your database information—your application does not need to be aware or maintain the connection information. OracleAS TopLink can access the database through a connection pool or a datasource. OracleAS TopLink JTA integration often uses a datasource.

You can configure a datasource as follows:

For more information about defined connection pools and datasources with EJB entity beans, see "Configuring the toplink-ejb-jar.xml File with the BEA WebLogic Server".

Container-Managed Persistence and Datasources

OracleAS TopLink Conatiner-Managed Persistence (CMP) applications can leverage datasources rather than connection pools. To use a datasource, configure Java Transaction Service (JTS) support. JTS is the specification that supports JTA.

To use a datasource, configure both a JTS and a non-JTS datasource in the toplink-ejb-jar.xml file. To configure the required sources, specify them in the datasource and non-jts-data-source tags in the login element. These tags correspond to JTS and non-JTS datasources respectively.

The values for these datasource tags correspond directly to the names of the datasources as defined in your J2EE container or application server. Following is an example of a partial toplink-ejb-jar.xml file listing, using datasources:

...
<datasource>myJtsDataSource</datasource>
<non-jts-data-source>myNonJtsDataSource</non-jts-data-source>
...

For more information, see "Configuring the toplink-ejb-jar.xml File with the BEA WebLogic Server".

JTA

You can integrate your OracleAS TopLink application with a transaction service that complies with JTA, thereby enabling sessions to:

  • Participate in distributed transactions

  • Leverage existing connection pools

  • Access several databases managed by the JTA system transparently

JTA is a Java 2 Enterprise Edition (J2EE) component.

For more information about leveraging JTA in your application, see "J2EE Integration".