|
Home TOC Index |
|
Search
Feedback |
The Black Box Resource Adapters
The J2EE SDK includes several black box resource adapters for performing end-to-end and compatibility testing. The underlying EIS of these adapters is a relational DBMS. The client API is the JDBC 2.0 API and the
javax.sql.DataSourceinterface. Underneath, the black box adapters use JDBC drivers to communicate with relational databases. For more information, see Configuring JDBCDrivers.
Note: Although the black box adapters use JDBC, resource adapters are not meant to replace JDBC for accessing relational databases. The black box adapters are for testing purposes only. Because they use JDBC, they can be plugged into existing tests that also use JDBC.
Transaction Levels
The black box resource adapters reside in the
$J2EE_HOME/lib/connector(UNIX) or%J2EE_HOME%\lib\connector(Windows) subdirectory. Table 17-1 lists the black box RAR files and the different transaction levels that they support.For the
XA_TRANSACTIONlevel, the underlying JDBC driver must support the XA requirements as defined by the JDBC 2.0 API.Properties
A resource adapter may contain properties, that is, name-value pairs containing information specific to the resource adapter and its underlying EIS. These properties are defined in the deployment descriptor of each black box RAR file. Because the EIS of a black box adapter is a relational database, the properties contain information required for connecting to a database. Table 17-2 lists the properties of the black box adapter files. Table 17-3 shows the default values for the black box properties.
Table 17-3 Default Values for Black Box Properties Property Name
Description
ConnectionURL
jdbc:cloudscape:rmi:CloudscapeDB;create=true
XADataSourceName
jdbc/XACloudscape_xa
To override a default property value, you set the value when adding a connection factory with the
j2eeadmincommand. See the section Administering Resource Adapters.Configuring JDBC
Drivers
If you are running the black box adapters against a Cloudscape database, you may skip this section. If you are using a database other than Cloudscape, you should perform the steps that follow.
The Non-XA Black Box Adapters
- Set the JDBC driver class. Use the
j2eeadmintool with the-addJdbcDriveroption and specify the driver class name. The syntax for this option is as follows:j2eeadmin -addJdbcDriver <class name>- Edit the
bin/userconfig.sh(UNIX) orbin\userconfig.bat(Windows) file, setting theJ2EE_CLASSPATHvariable to the location of the JDBC driver classes.- Restart the J2EE server.
The XA Black Box Adapters
- Set the
XADatasourceproperty. With thej2eeadmintool and the-addJdbcXADatasourceoption, specify the JNDI name and class name for theXADatasourceproperty. Optionally, you may specify the XA user name and password and you may override the default property value. The syntax follows:j2eeadmin -addJdbcXADatasource <jndi-name> <class-name> [<xa-user-name> <xa-password>] [-props (<name>=<value>)+]
- The preceding command results in two data sources. One is a
DataSourceobject with the specified JNDI name from which the J2EE application gets aConnectioninstance. The other is anXADatasourceobject whose JNDI name is the<jndi-name>parameter appended with two underscores andxa(<jndi-name>__xa). Behind the scenes, theDataSourceuses theXADataSourceto create connections.- Restart the J2EE server.
|
Home TOC Index |
|
Search
Feedback |