Datasource, Configuring datasource in nsasj, Installing the jdbc driver – HP Integrity NonStop H-Series User Manual

Page 65: Installing the driver jar as a deployment, Datasource configuring datasource in nsasj

Advertising
background image

DataSource

A DataSource is a repository for connections to the physical data source. A DataSource is
mainly used to pool connections and cache statements. Application Servers like JBoss provide
wrapper DataSources that wrap around a driver DataSource to give additional functionality.
Some features of the wrapper DataSource are discussed later.

Configuring DataSource in NSASJ

Configuring a DataSource in NSASJ involves the following steps:

1.

Installing the JDBC driver

2.

Configuring the DataSource

Installing the JDBC driver

The sole purpose of installing the JDBC driver is to make the driver class available for use by the
container. The driver can be installed either by deploying the driver jar into a running instance of
NSASJ, or by configuring the driver as a module.

Installing the driver jar as a deployment

The NSASJ Application Server needs the packaging of the JDBC driver to be compliant with JDBC
4.0 specification. This is because the Application Server recognizes the jar as a JDBC driver using
the Java Service Provider mechanism.

The latest SQL/MX JDBC T4 driver is JDBC 3.0 compliant. To make this JDBC 4.0 compliant with
respect to packaging, a META-INF/services folder needs to be added to the jar, and this folder
must contain a file by name java.sql.Driver with the content
com.tandem.t4jdbc.SQLMXDriver

.

Use the add_services.sh script located in the <NSASJ_HOME>/bin folder to make the necessary
modifications to the JDBC jar.

Once the necessary modifications are performed, the jar can be deployed as any other jar using
the CLI (command line interface).

For more information on the CLI, see

“Managing NSASJ” (page 80)

.

CertainSQL/MX JDBC t4 driver functionalities have dependency on libraries that are not packaged
along with the JDBC. Such dependencies can also be mentioned before deploying the JDBC jar.
The following explains the concept described in this section with the help of
useExternalTransaction

connection property of SQL/MX JDBC T4 driver:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<datasource jndi-name="java:jboss/SQLMXDS" pool-name="SQLMXPool"
enabled="true" use-java-context="true" jta="true">
<driver>t4sqlmx.jar</driver>
<connection-url>jdbc:t4sqlmx://15.154.120.44:23345/:</connection-url>
<connection-property> name="catalog">prodcat</connection-property>
<connection-property> name="schema">prodschema</connection-property>
<connection-property> name="user">prod.user</connection-property>
<connection-property> name="password">welcome</connection-property>
<connection-property> name="maxStatements">3</connection-property>
<connection-property> name="useExternalTransaction">yes</connection-property>
</datasource>
</datasources>

When using the useExternalTransaction attribute (as shown in the preceding example) the
driver needs to access a class by name com.tandem.tmf.Current that is in the tmf.jar in
the JAVA_HOME/jre/lib/ext folder, where JAVA_HOME is the folder location of NSJ7
installation. When deploying the driver, the container needs to be aware about the dependency.
The dependencies can be defined in the following two ways:

DataSource configuration

65

Advertising
This manual is related to the following products: