The J2EETM Tutorial
Home
TOC
PREV TOC NEXT 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.DataSource interface. Underneath, the black box adapters use JDBC drivers to communicate with relational databases. For more information, see Configuring JDBC Drivers.


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. The following table lists the blackbox RAR files and the different transaction levels that they support:

Table 33 Black Box Transaction Levels
File
Transaction Level
blackbox-notx.rar
NO_TRANSACTION
blackbox-tx.rar
LOCAL_TRANSACTION
blackbox-xa.rar
XA_TRANSACTION
cciblackbox-tx.rar
LOCAL_TRANSACTION
cciblackbox-xa.rar
XA_TRANSACTION

For the XA_TRANSACTION level, the underlying JDBC driver must support the XA requirements as defined by the JDBC 2.0 API.

Properties

A resource adapter may contain properties, name-value pairs containing information specific to the resource adapter and its underlying EIS. These properties are defined in the deployment descriptor of each blackbox RAR file. Because the EIS of a blackbox adapter is a relational database, the properties contain information required for connecting to a database. The following table lists the properties of the black box adapter files.

Table 34 Black Box Properties
File
Property Name
Description
blackbox-notx.rar
ConnectionURL
URL of database
blackbox-tx.rar
ConnectionURL
URL of database
blackbox-xa.rar
XADataSourceName
JNDI name of
XADataSource
cciblackbox-tx.rar
ConnectionURL
URL of database
cciblackbox-xa.rar
XADataSourceName
JNDI name of
XADataSource

The next table shows the default values for the black box properties.

Table 35 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 j2eeadmin command. 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

  1. Set the JDBC driver class. Use the j2eeadmin tool with the -addJdbcDriver option and specify the driver class name. The syntax for this option is:
    j2eeadmin -addJdbcDriver <class name> 
    
  2. Edit the bin/userconfig.sh (UNIX) or bin\userconfig.bat (Windows) file, setting the J2EE_CLASSPTH variable to the location of the JDBC driver classes.
  3. Restart the J2EE server.

The XA Black Box Adapters

  1. Set the XADatasource property. With the j2eeadmin tool and the addJdbcXADatasource option, specify the JNDI name and class name for the XADatasource property. 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 DataSource object with the specified JNDI name from which the J2EE application gets a Connection instance. The other is an XADatasource object whose JNDI name is the <jndi-name> parameter appended with two underscores and xa (<jndi-name>__xa). Behind the scenes, the DataSource uses the XADataSource to create connections.
  2. Restart the J2EE server.
Home
TOC
PREV TOC NEXT Search
Feedback