Operating Systems: i5/OS
Personalize the table of contents and search results
Create and configuring a JDBC provider and data source using the
Java Management Extensions API
If your application requires access to a JDBC connection pool from
a J2EE 1.3 or 1.4 level WebSphere Application Server component, you can create
the necessary JDBC provider and data source objects using the Java Management
Extensions (JMX) API exclusively.
Overview
Alternatively, you can use the JMX
API in combination with the WSadmin - scripting tool.
Note: Use the
JMX API to create only data sources for which the product does not provide
a template. For every JDBC provider WebSphere Application Server supports,
the product provides a corresponding data source template. You can create
supported providers and associated data sources through the administrative
console, or by using 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 WebSphere Application Server running on Windows
platforms.
Procedure
- Put the appropriate JAR files in your classpath. You will need the com.ibm.ws.admin.client_6.1.0.jar JAR
file in your classpath. The
following command is an example for setting your classpath:
set classpath=%classpath%;install_root\runtime\com.ibm.ws.admin.client_6.1.0.jar
- Look up the host and get an administration client handle.
- Get a configuration service handle.
- Update the resource.xml file using the configuration service
as desired.
- Add a JDBC provider.
- Add the data source.
- Add the connection factory. This step is necessary only for
data sources that must support container-managed persistence.
- 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.
- Locate the DataSourceConfigHelper MBean using the name.
- Put together the signature and parameters for the call.
- Invoke the reload() call.
- Attention: If you modify the class path or native library
path of an existing JDBC provider, restart every application server
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 Reference
Example: Testing a connection using testConnection(ConfigID) Data sources (WebSphere Application Server V4) Data source collection CMP connection factories collection JDBC provider collection
|