The J2EETM Tutorial
Home
TOC
Index
PREV TOP 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. Table 17-1 lists the black box RAR files and the different transaction levels that they support.

Table 17-1 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, 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-2 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

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 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 as follows:
    j2eeadmin -addJdbcDriver <class name>
     
    
  2. Edit the bin/userconfig.sh (UNIX) or bin\userconfig.bat (Windows) file, setting the J2EE_CLASSPATH 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
Index
PREV TOP NEXT Search
Feedback