JDBC Data Source Configuration Examples

This appendix provides examples of configuring data sources of major database vendors.

1. Overview

Configurations of the following JDBC data sources are shown in the examples of this appendix.

  • Oracle Thin

  • Oracle OCI

  • DB2 Type4(JCC)

  • DB2 Type2(JCC)

  • Sybase jConnect 5.x, 6.x

  • MSSQL 2005 Type4

  • Informix Type4

  • Tibero Type4

  • MySQL 5.x Type4

You can configure a data source by referring to this appendix. For more information on how to configure data sources, refer to Data Source Configuration.

2. Oracle Thin (Type4) Configuration Example

2.1. Oracle Thin Connection Pool Data Source

The following example shows how to configure an Oracle Thin connection pool data source.

Oracle Thin Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>ora_thin_cpds</data-source-id>
                <export-name>ora_thin_cpds</export-name>
                <data-source-class-name>
                    oracle.jdbc.pool.OracleConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>oracle</vendor>
                <server-name>192.168.1.2</server-name>
                <port-number>1521</port-number>
                <database-name>orcl</database-name>
                <user>scott</user>
                <password>tiger</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.String</type>
                    <value>thin</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

2.2. Oracle Thin XA Data Source

The following example shows how to configure an Oracle Thin XA data source.

Oracle Thin XA Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>ora_thin_xads</data-source-id>
                <export-name>ora_thin_xads</export-name>
                <data-source-class-name>
                    oracle.jdbc.xa.client.OracleXADataSource
                </data-source-class-name>
                <data-source-type>
                    XADataSource
                </data-source-type>
                <vendor>oracle</vendor>
                <server-name>192.168.1.2</server-name>
                <port-number>1521</port-number>
                <database-name>orcl</database-name>
                <user>scott</user>
                <password>tiger</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.String</type>
                    <value>thin</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

2.3. Configuring java.util.Properties File with Oracle ASO

This section describes how to configure java.util.Properties with Oracle ASO.

Using the <property> element, set <type> to java.util.Properties and <value> as follows:

 [property name 1]=[value 1], [property name 2]=[value 2]
Example of java.util.Properties Configuration with Oracle ASO: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>oracle_CPDS1</data-source-id>
                <export-name>oracle_CPDS1</export-name>
                <data-source-class-name>
                    oracle.jdbc.pool.OracleConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>oracle</vendor>
                <server-name>192.168.1.2</server-name>
                <port-number>1521</port-number>
                <database-name>ora9</database-name>
                <user>scott</user>
                <password>tiger</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.String</type>
                    <value>thin</value>
                </property>
                <property>
                    <name>ConnectionProperties</name>
                    <type>java.util.Properties</type>
                    <value>
                        oracle.net.encryption_client=xxxx,
                        oracle.net.encryption_types_client=(3DES168,3DES112),
                        oracle.net.crypto_checksum_client=xxxx,
                        oracle.net.crypto_checksum_types_client=(MD5)
                    </value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

3. Oracle OCI (Type2) Configuration Example

3.1. Oracle OCI Connection Pool Data Source

To use the Oracle OCI driver, configure the driver’s native library path by using the '-Djava.library.path' option when starting JEUS.

Oracle OCI Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>ora_oci_cpds</data-source-id>
                <export-name>ora_oci_cpds</export-name>
                <data-source-class-name>
                    oracle.jdbc.pool.OracleConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>oracle</vendor>
                <server-name>192.168.1.2</server-name>
                <port-number>1521</port-number>
                <database-name>ora9</database-name>
                <user>scott</user>
                <password>tiger</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.String</type>
                    <value>oci</value>
                </property>
                <property>
                    <name>TNSEntryName</name>
                    <type>java.lang.String</type>
                    <value>ORCL</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

4. DB2 Configuration Example

4.1. DB2 Type4 (JCC) Connection Pool Data Source

The following example shows how to configure a DB2 Type4 connection pool data source.

DB2 Type4 (JCC) Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>db2_type4_cpsd</data-source-id>
                <export-name>db2_type4_cpds</export-name>
                <data-source-class-name>
                    com.ibm.db2.jcc.DB2ConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>db2</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>50000</port-number>
                <database-name>TEST1</database-name>
                <user>db2inst1</user>
                <password>password</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.Integer</type>
                    <value>4</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

4.2. DB2 Type4 (JCC) XA Data Source

The following example shows how to configure a DB2 Type4 XA data source.

DB2 Type4 (JCC) XA Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>db2_type2_cpsd</data-source-id>
                <export-name>db2_type2_cpds</export-name>
                <data-source-class-name>
                    com.ibm.db2.jdbc.DB2XADataSource
                </data-source-class-name>
                <data-source-type>
                    XADataSource
                </data-source-type>
                <vendor>db2</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>50000</port-number>
                <database-name>TEST1</database-name>
                <user>db2inst1</user>
                <password>password</password>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

4.3. DB2 Type2 (JCC) XA Data Source

To use a DB2 Type 2 driver, configure the native library path of the DB2 client in the system library path, or use the '-Djava.library.path' option when starting JEUS after installing the DB2 client and configuring the DB Alias. The following example shows that the database name is the DB Alias, and the server address and port number of DB2 are not needed.

B2 Type2 (JCC) XA Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>db2_type2_xads</data-source-id>
                <export-name>db2_type2_xads</export-name>
                <data-source-class-name>
                    com.ibm.db2.jdbc.DB2XADataSource
                </data-source-class-name>
                <data-source-type>
                    XADataSource
                </data-source-type>
                <vendor>db2</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>50000</port-number>
                <database-name>TEST1</database-name>
                <user>db2inst1</user>
                <password>password</password>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

5. Sybase Configuration Example

5.1. Sybase jConnect 5.x Connection Pool Data Source

The following example shows how to configure a Sybase jConnect 5.x connection pool data source.

Sybase jConnect 5.x Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>syb_jconn5_cpds</data-source-id>
                <export-name>syb_jconn5_cpds</export-name>
                <data-source-class-name>
                    com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>sybase</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>5000</port-number>
                <database-name>testdb</database-name>
                <user>sa</user>
                <password>password</password>
                <property>
                    <name>networkProtocol</name>
                    <type>java.lang.String</type>
                    <value>Tds</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

5.2. Sybase jConnect 6.x XA Data Source

The following example shows how to configure a Sybase jConnect 6.x XA data source.

Sybase jConnect 6.x XA Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>syb_jconn6_xads</data-source-id>
                <export-name>syb_jconn6_xads</export-name>
                <data-source-class-name>
                    com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>sybase</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>5000</port-number>
                <database-name>testdb</database-name>
                <user>sa</user>
                <password>password</password>
                <property>
                    <name>networkProtocol</name>
                    <type>java.lang.String</type>
                    <value>Tds</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

6. MSSQL Configuration Example

6.1. MSSQL 2005 Connection Pool Data Source

The following example shows how to configure an MSSQL 2005 connection pool.

MSSQL 2005 Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>mssql_2005_cpds</data-source-id>
                <export-name>mssql_2005_cpds</export-name>
                <data-source-class-name>
                    com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>mssql</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>1411</port-number>
                <database-name>testdb</database-name>
                <user>jeusdb1</user>
                <password>password</password>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

ODBC must be configured before configuring JDBC.

7. Informix Configuration Example

7.1. Informix Connection Pool Data Source

The following example shows how to configure an Informix connection pool data source.

Informix Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>infomix_cpds</data-source-id>
                <export-name>infomix_cpds</export-name>
                <data-source-class-name>
                    com.informix.jdbcx.IfxConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>informix</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>2002</port-number>
                <database-name>skynps</database-name>
                <user>informix</user>
                <password>password</password>
                <property>
                    <name>IfxIFXHOST</name>
                    <type>java.lang.String</type>
                    <value>192.168.1.43</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

8. Tibero Configuration Example

8.1. Tibero Connection Pool Data Source

The following example shows how to configure a Tibero connection pool data source.

Tibero Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>tibero_cpds</data-source-id>
                <export-name>tibero_cpds</export-name>
                <data-source-class-name>
                    com.tmax.tibero.jdbc.ext.TbConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>tibero</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>8629</port-number>
                <database-name>testdb</database-name>
                <user>jeusdb1</user>
                <password>password</password>
                <property>
                    <name>driverType</name>
                    <type>java.lang.String</type>
                    <value>thin</value>
                </property>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>

9. MySQL 5.x Configuration Example

9.1. MySQL Connector/J Connection Pool Data Source

The following example shows how to configure a MySQL Connector/J connection pool data source.

MySQL Connector/J Connection Pool Data Source: <domain.xml>
<domain>
    . . .
    <resources>
        <data-source>
            <database>
                <data-source-id>mysql_cpds</data-source-id>
                <export-name>mysql_cpds</export-name>
                <data-source-class-name>
                  com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
                </data-source-class-name>
                <data-source-type>
                    ConnectionPoolDataSource
                </data-source-type>
                <vendor>mysql</vendor>
                <server-name>192.168.1.1</server-name>
                <port-number>3306</port-number>
                <database-name>testdb</database-name>
                <user>tester</user>
                <password>password</password>
                <connection-pool>
                    . . .
                </connection-pool>
            </database>
        . . .
        </data-source>
    . . .
    </resources>
</domain>