23.1 Data Source overview
Portlet applications access relational databases through the JDBC API to store, organize, and retrieve data. As an option, databases can also be accessed via DataSource objects. In this case, the connection object that the getConnection() method returns is a handle to a PooledConnection object rather than being a physical connection.
In the general sense, using a connection pooling has no impact on portlet applications except that connections should be closed. When a portlet application closes a connection that is pooled, the connection is returned to a pool of reusable connections. Using a connection pool will give you the following benefits:
![]()
A connection does not need to be created every time one is requested.
![]()
You configure the minimum and maximum number of connections and therefore you control the connectivity to a database to significantly improve performance. In WebSphere Application Server V5, a data source is associated with a JDBC provider that supplies the specific JDBC driver implementation class. The data source represents the J2EE Connector Architecture (JCA) connection factory for the relational resource adapter. The JCA Connection Manager provides the connection pooling, local transaction, and security supports. The relational resource adapter provides both JDBC wrappers and JCA CCI implementation that allows BMP, JDBC applications, and CMP beans to access the database.
Figure 23-1 JDBC Data Source using connection pooling
Note: For more details about data source, see the WebSphere Portal Server V5 InfoCenter.
When an application uses a version 5 data source, the data source will use the JCA connector architecture to get to the relational database. Although there is no difference between the existing WebSphere JDBC support and the new support in terms of application development, there will be some connection behavior changes because of different architectures. For example:
![]()
The connection factory delegates the request to a connection manager.
![]()
The connection manager looks for an instance of a connection pool in the application server. If no connection pool is available, then the manager uses the ManagedConnectionFactory to create a physical (nonpooled) connection.
ibm.com/redbooks