About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Recommended Resources
Abstract
This technote provides an application which can be deployed to WebSphere Application Server for testing database connectivity via a data source.
Content
An application EAR, SimpleServletEar.ear, is provided to obtain a connection from the connection pool and test the connectivity to the database. Sometimes it is desired to test connectivity from an application because the "Test Connection" function in the Admin Console is done using the deployment manager or a nodeagent, rather than an application server, and a JNDI lookup of the data source is not done with "Test Connection". This application is not meant to be used in a Production environment.
Install the application to your application server in the administrative console. Select "Detailed" path. In the step "Map resource references to resources", select the JNDI name of the data source which will be tested under "Target Resource JNDI Name".
After you have successfully installed the application, start it. Use the following URL in a web browser to invoke the servlet which will then connect to the database:
http://<host name>:<port>/SimpleServlet
One of the following two messages will be returned to the browser:
1. "We are in simple servlet - successfully connected to the database" - this message indicates that the connection has been successful.
2. "We are in simple servlet - failed to connect to the database. Error: " - this message indicates that the connection failed. The detailed error message and stack trace is returned to the browser.
[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"DB Connections\/Connection Pooling","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5.5;8.0;7.0","Edition":"Base;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}}]
Was this topic helpful?
Document Information
More support for:
WebSphere Application Server
Software version:
9.0, 8.5.5, 8.0, 7.0
Operating system(s):
AIX, HP-UX, Linux, Solaris, Windows
Document number:
475817
Modified date:
15 June 2018
UID
swg21595671
Manage My Notification Subscriptions