Configure a JDBC provider and data source
For access to relational databases, applications use the JDBC drivers and data sources.
Each vendor database requires different JDBC driver implementation classes for JDBC connectivity. A JDBC provider encapsulates those vendor-specific driver files. Through the data source associated with the JDBC provider, an application server obtains and manages the physical connections for transactions between applications and the database.
If accessing a DB2 database, IBM Optim pureQuery Runtime is an alternative to JDBC.
Before starting this task, determine the version of data source needed according to the API specification of the applications.
Configure a JDBC provider and data source
- Verify required JDBC driver files are installed on the node manager.
- Create a JDBC provider.
- Create a data source.
Different database vendors require different properties for implementations of their JDBC drivers. Set these properties on the WAS data source. Because Application Server contains templates for many vendor JDBC implementations, the administrative console surfaces the required properties and prompts you for them as we create a data source. However, if you script the data access configurations, consult the article Data source minimum required settings, by vendor, for the required properties and settings options.
- Optional: Configure custom properties.
Like the required properties, custom properties for specific vendor JDBC drivers must be set on the application server data source. Consult the database documentation for information about available custom properties. To configure a custom class to facilitate the handling of database properties that are not recognized natively by the Application Server, refer to the topic, Developing a custom DataStoreHelper class.
There are also optional data source properties, such as the DB2 sslConnection custom property, that we might want to configure. Refer to the Application Programming Guide and Reference for Java for your version of DB2 for z/OS if we use the DB2 Universal JDBC Driver provider for more information about these custom properties.
- Bind resource references to the data source.
- Test the connection (for non-container-managed persistence usage).
If we use the DB2 JDBC Universal Driver, we might experience data source failures that the application server JVM log does not document. Check the DB2 database log or the WAS JDBC trace log (if JDBC trace was active). We might find that a bad authentication credential is the cause of failure. Currently the DB2 JDBC Universal Driver does not identify or surface the errors that are produced by non-valid authentication credentials in a proper or consistent way.
Even if we receive information about a bad credential, check the database and JDBC trace logs. These logs provide more reliable, detailed error data on authentication failures.
The JDBC trace log exists only if the JDBC trace service is active during server start up. Activate the service in the administrative console. See topic, Enabling trace at server startup. Specify WAS.database as the trace group and select com.ibm.ws.db2.logwriter as the trace string.bprac
Subtopics
- Configure a JDBC provider
- Configure a JDBC provider for a clustered environment
- Create and configure a JDBC provider and data source using the JMX API
- Configure a data source
- Data source minimum required settings, by vendor
- Data source minimum required settings for Apache Derby
- Data source minimum required settings for DB2 with the application server on AIX, HP-UX, Linux, Solaris, or Windows
- Data source minimum required settings for DB2 on z/OS and an application server on z/OS
- Data source minimum required settings for DB2 Universal Database for IBM i
- Data source minimum required settings for Informix
- Data source minimum required settings for Microsoft SQL Server
- Data source minimum required settings for Oracle
- Data source minimum required settings for Sybase
- Test connection service
- Test a connection with the administrative console
- Test a connection using wsadmin
- Verify a data source connection
- Set up a connection to an HADR-enabled DB2 database
- ResourceManagement
- Access an existing Java EE data source resource
- Use the DB2 Universal JDBC Driver to access DB2 for z/OS
- Create a data source that uses the Oracle JDBC Driver for OCI
- Configure Oracle Real Application Cluster (RAC) with the application server
- Configure client reroute for applications that use DB2 databases
- Configure client affinities for applications that use DB2 databases
- Configure data source JDBC providers to use pureQuery in a Java SE environment
Related:
JDBC providers Data sources Resource reference benefits Data source lookups for enterprise beans and web modules Configure a JDBC provider using wsadmin Configure new data sources using wsadmin Configure new WAS40 data sources using wsadmin.sh (deprecated) Extend DB2 data source definitions at the application level Enable trusted context for DB2 databases Configure the application server and DB2 to authenticate with Kerberos Developing a custom DataStoreHelper class IBM Optim pureQuery Runtime Data source collection Data source (WAS V4) collection (deprecated) JDBC provider collection