WAS v8.5 > Administer applications and their environment > Welcome to administering Data access resources > Administer data access applications > Configure a JDBC provider and data source

Access an existing Java EE data source resource

The same DataSource MBean and JDBCProvider MBean programming model that we use to access a WebSphere Application Server managed data source (defined in scripting or the Integrated Solutions Console) can be used to access a Java™ Platform Enterprise Edition (Java EE) data source resource defined in the application with the DataSourceDefinition annotation or with the <data-source> element of the deployment descriptor. This feature maintains compatibility with existing scripts, simplifying the management of your resources.

This task illustrates through examples how an MBean represents a Java EE data source resource.


Use the DataSource MBean

Use the name field of the DataSource MBean as the JNDI name with special characters, as follows:

JNDI name =  java:module/env/jdbc/myDataSource
name = java.module/env/jdbc/myDataSource

Additional fields for application, module, and component are included whenever applicable; for example:

Using these values, we can query for the MBean for a particular application, as follows:

or query for an identically named java:app JNDI name in a different application as follows:

A query that omits the application field returns both MBeans as follows:

In the web module, the Java EE specification defines java:comp to be the same namespace as java:module. Therefore, MBean queries for data sources that are defined in the web module should not include the component field.

To query for java:comp/env/ds1 defined in the web module, use the following:

To query for java:comp/env/ds2 defined in an EJB module, use the following:

To query for java:app/env/myDataSource defined in an application named MyApp, use the following:

To query for an identically named java:app JNDI name in a different application named MyOtherApp, use the following:

The application, module, and component parameters can also be used to perform a general query for all data sources that are defined in a particular application; for example:

In addition to the DataSource MBean for each Java EE data source, there is also a JDBCProvider MBean. The name of the JDBCProvider MBean is the name of the DataSource MBean prefixed with JDBCProvider_, for example:

The JDBCProvider MBean has one data source associated with it, as illustrated in the following example:


Related


Configure a JDBC provider and data source


Reference:

Data source minimum required settings, by vendor


+

Search Tips   |   Advanced Search