+

Search Tips   |   Advanced Search

Create and configuring a JDBC provider and data source using the Java Management Extensions API


If the application requires access to a JDBC connection pool from a J2EE 1.3 or 1.4, or Java Platform Enterprise Edition (Java EE) level WAS component, we can create the necessary JDBC provider and data source objects using the Java Management Extensions (JMX) API exclusively.

Alternatively, we can use the JMX API in combination with the WSadmin - scripting tool.

Use the JMX API to create only data sources for which WAS does not provide a template. For every JDBC provider WAS supports, WAS provides a corresponding data source template. We can create supported providers and associated data sources through the admin console. See the topic, Set a JDBC provider and data source. Or, we can use the wsadmin - scripting tool. For a complete list of supported JDBC providers (and therefore a complete list of data sources that must be created using a template), refer to the topic, Data source minimum required settings, by vendor.

These steps outline the general procedure for using the JMX API to create a JDBC provider and data source, on WAS running on Windows platforms.

 

  1. Put the appropriate JAR files in the classpath. You need thecom.ibm.ws.admin.client_6.1.0.jar JAR file in your classpath.

    The following command is an example for setting the classpath:

    set classpath=%classpath%;install_root\runtime\com.ibm.ws.admin.client_6.1.0.jar
    

  2. Look up the host and get an administration client handle.

  3. Get a configuration service handle.

  4. Update the resource.xml file using the configuration service as desired.

    1. Add a JDBC provider.

    2. Add the data source.

    3. Add the connection factory. This step is necessary only for data sources that must support container-managed persistence.

  5. Reload the resource.xml file to bind the newly created data source into the JNDI namespace. Perform this step to use the newly created data source right away without restarting the application server.

    1. Locate the DataSourceConfigHelper MBean using the name.

    2. Put together the signature and parameters for the call.

    3. Invoke the reload() call.

  6. Attention: If we modify the class path or native library path of an existing JDBC provider, restart every appserver within the scope of that JDBC provider for the new configuration to work. Otherwise, you receive a data source failure message.


Example: Using the Java Management Extensions API to create a JDBC driver and data source for a CMP bean
Example: Using the Java Management Extensions API to create a JDBC driver and data source for BMP beans, session beans, or servlets
Example: Creating a JDBC provider and data source using Java Management Extensions API and the scripting tool

 

Related concepts


JDBC providers
Data sources

 

Related tasks


Set a JDBC provider and data source
Set data access with scripting

 

Related


Example: Testing a connection using testConnection(ConfigID)
Data source (WAS V4) collection
Data source collection
CMP connection factories collection
JDBC provider collection