Chapter 9. Accessing relational databases from WebSphere 379
There are two transaction scopes in WebSphere Application Server:
Global transaction
Local transaction containment (LTC)
9.9.2 Configuring Shared and Unshared Connections
This section provides information about configuring shared and unshared connections:
Resource Reference: The resource reference can be used to configure connection
sharing for connection factory or data source. Example 9-1 shows how to configure
shared connections for a data source using the resource reference.
Example 9-1 Shared connections for a data source
<resource-ref>
<jndi-name>jdbc/Acount</jndi-name>
<authentication-alias>Alias1</authentication-alias>
<interface>javax.sql.DataSource</interface>
<authentication>Container</authentication>
<sharing-scope>Shareable</sharing-scope>
<id>resourceRef</id>
</resource-ref>
Connection pool Custom properties: Custom properties, defaultConnectionTypeOverride
and globalConnectionTypeOverride can be used to control connection sharing for a
particular connection factory or data source:
defaultConnectionTypeOverride
Changes the default sharing value for a connection pool. The value configured through
resource references takes precedence over this property.
globalConnectionTypeOverride:
The value takes precedence over all of the other connection sharing settings for
connection factory or data source.
More information about Connection pool Custom properties is in the information center at the
following website:
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.webspher
e.express.iseries.doc%2Fae%2Frdat_conpoolcustprops.html
9.10 Troubleshooting database access problems
This section describes ways to troubleshoot database access problems with WebSphere
Application server. The following topics are covered:
Enabling JDBC tracing for database problems
Enabling ConnLeakLogic
Dumping connection pool information using wsadmin
Tool to debug Database Access problems
380 WebSphere Application Server V8.5 Administration and Configuration Guide for the Full Profile
9.10.1 Enabling JDBC tracing for database problems
If the problem can be reproduced easily, enable a WebSphere Application Server trace. To
enable the tracing:
1. Click Troubleshooting Logs and Trace in the Application Server administrative
console.
2. In the Logging and Tracing, select your Server Diagnostic Trace.
3. Go to Trace Output File. Accept the defaults.
4. Click OK.
5. Select change the Log Detail Levels.
6. Enter the following strings depending on your connection type:
Connecting to a database enter:
*info:
WAS.j2c=all:
RRA=all:
Transaction=all
Connecting to an enterprise information system enter:
*info:
WAS.j2c=all:
com.ibm.connector2.*all:
Transaction=all
Connecting to a messaging system enter:
*info:
WAS.j2c=all:
Messaging=all:
JMSApi=all:
Transaction=all
7. Save your configuration and then click OK.
8. Restart the Application Server.
9. Reproduce the problem.
10.Send the resulting trace output file to IBM support for further analysis.
9.10.2 Enabling ConnLeakLogic
Connection pools get exhausted due to a variety of reasons, and ConnLeakLogic can be
enabled to identify the application code holding the connections for long durations. It is
recommended to enable a ‘Runtime’ trace instead of a ‘Configuration’ trace, which allows the
trace to be disabled after the diagnostic data is retrieved from the server. To enable the
ConnLeakLogic:
1. Start the application server.
2. Enable a Runtime trace immediately after starting the server:
a. Click Troubleshooting Logs and Trace in the WebSphere Application Server
administrative console.
b. Select the link for your server.
c. Click Diagnostic Trace.
Chapter 9. Accessing relational databases from WebSphere 381
d. Click Runtime tab.
e. Click Change Log Level Details.
f. Click the Runtime tab.
g. In the Trace Specification field, enter ConnLeakLogic=all.
h. Click OK.
9.10.3 Dumping connection pool information using wsadmin
For collecting diagnostic data you can look at the SystemOut.log while the system is running.
If you see the J2CA0045E error message in SystemOut.log, invoke wsadmin to dump the pool
contents of the data source.
Use one of the following commands to dump the content of the connection pool:
C:\IBM\WebSphere\bin>wsadmin -c “$AdminControl invoke [$AdminControl queryNames
\”*:name=<INSERT DISPLAY NAME OF DATASOURCE HERE>,process=<SERVER
NAME>,node=<NODE NAME>,j2eeType=JDBCDataSource,*\”] showPoolContents” -user
<adminuserid> -password <adminpw>
C:\IBM\WebSphere\bin>wsadmin>set ds [$AdminControl queryNames “*:name=<INSERT
DISPLAY NAME OF DATASOURCE HERE>,process=<SERVER NAME>, node=<NODE
NAME>,j2eeType=JDBCDataSource,*”]
wsadmin>$AdminControl invoke $ds showPoolContents
9.10.4 Tool to debug Database Access problems
For debugging database access problems, you can use the IBM Database Connection Pool
Analyzer. This tool finds JDBC connection leaks and helps to resolve JDBC connection pool
problems. The tool performs the following functions:
Analysis of JDBC data source
Java stack trace view of getConnection method
JDBC connection chart view
Analysis of JDBC connection pool configuration
You can download the IBM Database Connection Pool Analyzer from the following website:
https://www.ibm.com/developerworks/mydeveloperworks/groups/service/html/communityv
iew?communityUuid=f324412c-747c-42b9-8a70-a4d54e5f0e03
Note: Ensure that you enabled the trace immediately after the server is started before any
connections are obtained from the connection pool.
A trace.log is created that contains similar content as the SystemOut.log. It does not log
ongoing messages, such as a WAS.j2c trace, and it causes only slight performance
impact.
382 WebSphere Application Server V8.5 Administration and Configuration Guide for the Full Profile

Get WebSphere Application Server V8.5 Administration and Configuration Guide for the Full Profile now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.