내용 목차
본 부록에서는 주요 DB 벤더들에 대한 데이터소스 설정 예제를 제공한다.
본 부록에서 설정 예제를 제공하는 JDBC 데이터소스는 다음과 같다.
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
본 부록을 참고하여 WebAdmin을 통해 데이터소스 설정을 하면 된다. WebAdmin을 통해 데이터소스를 설정하는 방법은 “6.4. 데이터소스 설정”을 참고한다.
XML 의 element 와 WebAdmin을 통해 데이터소스 설정옵션들은 1대1 매핑이되어 이름이 같다.
다음은 WebAdmin에서 Oracle Thin Connection Pool 데이터소스를 구성한 예이다.
[예 B.1] <<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>
다음은 WebAdmin에서 Oracle Thin XA 데이터소스를 구성한 예이다.
[예 B.2] <<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>
Oracle ASO 설정 예제를 이용해서 java.util.Properties 설정 방법에 대해 설명한다.
<property>를 사용하고, 기본 형식은 <type>은 java.util.Properties, <value>는 다음의 형식으로 입력한다.
[프로퍼티 이름 1]=[값 1], [프로퍼티 이름 2]=[값 2]
[예 B.3] <<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>
Oracle OCI 드라이버를 사용하기 위해서는 선행 작업이 필요한데, JEUS를 실행할 때 -Djava.library.path로 Oracle OCI 드라이버의 네이티브 라이브러리 경로를 설정해야 한다.
[예 B.4] <<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>
다음은 WebAdmin에서 DB2 Type4 Connection Pool 데이터소스를 구성한 예이다.
[예 B.5] <<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>
다음은 DB2 Type4 XA 데이터소스를 구성한 에이다.
[예 B.6] <<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>
DB2 Type 2 드라이버를 사용하기 위해서는 DB2 클라이언트를 설치하여 DB Alias를 설정한 뒤 JEUS를 실행할 때 -Djava.library.path 또는 시스템의 라이브러리 경로에 DB2 클라이언트의 네이티브 라이브러리 경로를 설정해야 한다. 다음의 예제에서 Database Name이 DB Alias가 되고 DB2 서버 주소와 포트 번호는 입력할 필요가 없다.
[예 B.7] <<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>
다음은 WebAdmin에서 Sybase jConnect 5.x Connection Pool 데이터소스를 구성한 예이다.
[예 B.8] <<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>
다음은 WebAdmin에서 Sybase jConnect 6.x XA 데이터소스를 구성한 예이다.
[예 B.9] <<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>
다음은 WebAdmin을 사용해서 MSSQL 2005 Connection Pool을 구성한 예이다.
[예 B.10] <<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 설정은 JDBC보다 먼저 설정되어야 한다.
다음은 WebAdmin을 사용해서 Informix Connection Pool 데이터소스를 구성한 예이다.
[예 B.11] <<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>
다음은 WebAdmin을 사용해서 Tibero Connection Pool 데이터소스를 구성한 예이다.
[예 B.12] <<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>
다음은 WebAdmin을 사용해서 MySQL Connector/J Connection Pool 데이터소스를 구성한 예이다.
[예 B.13] <<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>