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

Why and when to perform this task

You need two JAR files in your classpath -- wsexception.jar and wasjmx.jar. The following command is an example for setting your classpath:
set classpath=%classpath%;D:\WebSphere\AppServer\lib\wsexception.jar;D:\WebSphere\AppServer\lib\wasjmx.jar
The usual program follows these main points:

Steps for this task

  1. Look up the host and get an administration client handle.
  2. Get a configuration service handle.
  3. 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 (for container-managed persistence)
  4. Reload the resource.xml file to bind the newly created data source into the JNDI namespace. Perform this step if you want 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.

    Note: The jdbc-resource-provider-templates.xml file should be handled as read only. When updating this file, special consideration should be taken. Before installing the PTF, you should save your updated jdbc-resource-provider-templates.xml file. After applying the PTF, you will need to verify that the new jdbc-resource-provider-templates.xml file has your correct entries. If the entries are not valid, you will have to merge your changes into this new jdbc-resource-provider-templates.xml file manually.


Related concepts
Connection factory
JDBC providers
Data sources
Related reference
Example: Using the Java Management Extensions API to create a JDBC driver and data source for container-managed persistence
Example: Using the Java Management Extensions API to create a JDBC driver and data source for bean-managed persistence, session beans, or servlets
Example: Test a connection to a data source
Example: Creating a JDBC provider and data source using Java Management Extensions API and the scripting tool
Data Sources (Version 4)
Data Source collection
CMP Connection Factories collection
JDBC Provider collection



Searchable topic ID:   cjmxapis
Last updated: Jun 21, 2007 4:55:42 PM CDT    WebSphere Application Server Network Deployment, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/tdat_cjmxapis.html

Library | Support | Terms of Use | Feedback