내용 목차
본 부록에서는 주요 JDBC 드라이버들에 대한 Connection Pool 설정 예제를 제공한다.
설정 가능한 JDBC Datasource는 다음과 같다.
Oracle Thin
Oracle OCI
DB2 Type 4(JCC)
DB2 Type 2(JCC)
Sybase jConnect 5.x, 6.x
MSSQL 2005 Type 4
Informix Type 4
Tibero Type 4
MySQL 5.x Type 4
본 부록의 XML 예제들은 JEUSMain.xml에 작성하면 된다. 각 예제에서 중요한 값들은 bold체로 표현한다.
[예 B.1] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>oracle</vendor> <export-name>datasource1</export-name> <data-source-class-name> oracle.jdbc.pool.OracleConnectionPoolDataSource </data-source-class-name> <data-source-type> ConnectionPoolDataSource </data-source-type> <database-name>orcl</database-name> <port-number>1521</port-number> <server-name>192.168.1.1</server-name> <user>scott</user> <password>tiger</password> <property> <name>driverType</name> <type>java.lang.String</type> <value>thin</value> </property> <connection-pool> <pooling> <min>2</min> <max>4</max> <period>600000</period> </pooling> <wait-free-connection> <enable-wait>true</enable-wait> <wait-time>10000</wait-time> </wait-free-connection> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.2] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>oracle</vendor> <export-name>xaoralce</export-name> <data-source-class-name> oracle.jdbc.xa.client.OracleXADataSource </data-source-class-name> <data-source-type>XADataSource</data-source-type> <database-name>ora9</database-name> <port-number>1521</port-number> <server-name>192.168.1.2</server-name> <user>scott</user> <password>tiger</password> <property> <name>driverType</name> <type>java.lang.String</type> <value>thin</value> </property> <connection-pool> <pooling> <min>2</min> <max>10</max> <period>1800000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
Oracle ASO 설정 예제를 이용해서 java.util.Properties 설정 방법에 대해 설명한다.
<property>를 사용하고, 기본 형식은 <type>은 java.util.Properties, <value>는 다음의 형식으로 입력한다.
[프로퍼티 이름 1]=[값 1], [프로퍼티 이름 2]=[값 2]
[예 B.3] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>oracle</vendor> <export-name>xaoralce</export-name> <data-source-class-name> oracle.jdbc.pool.OracleConnectionPoolDataSource </data-source-class-name> <data-source-type> ConnectionPoolDataSource </data-source-type> <database-name>ora9</database-name> <port-number>1521</port-number> <server-name>192.168.1.2</server-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> <pooling> <min>2</min> <max>10</max> <period>1800000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
Oracle OCI 드라이버를 사용하기 위해서는 선행 작업이 필요하다.
JEUS 실행 스크립트(JEUS_HOME/bin/jeus 또는 jeus.bat)에서 -Djava.library.path로 Oracle OCI 드라이버의 네이티브 라이브러리 경로를 설정해야 한다.
[예 B.4] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>oracle</vendor> <export-name>oracle_oci_pool1</export-name> <data-source-class-name> oracle.jdbc.pool.OracleConnectionPoolDataSource </data-source-class-name> <data-source-type>ConnectionPoolDataSource</data-source-type> <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> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> </connection-pool> </database> </data-source> </resource> . . . </jeus-system>
[예 B.5] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>db2</vendor> <export-name>db2_pool1</export-name> <data-source-class-name> com.ibm.db2.jcc.DB2ConnectionPoolDataSource </data-source-class-name> <data-source-type>ConnectionPoolDataSource</data-source-type> <database-name>TEST1</database-name> <port-number>50000</port-number> <server-name>192.168.14.246</server-name> <user>db2inst1</user> <password>db2inst1</password> <property> <name>driverType</name> <type>java.lang.Integer</type> <value>4</value> </property> <connection-pool> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> <check-query> SELECT COUNT(*) FROM SYSIBM.SYSTABLES </check-query> <non-validation-interval>10000</non-validation-interval> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.6] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>db2</vendor> <export-name>db2_xa1</export-name> <data-source-class-name> com.ibm.db2.jcc.DB2XADataSource </data-source-class-name> <data-source-type>XADataSource</data-source-type> <database-name>TEST1</database-name> <port-number>50000</port-number> <server-name>192.168.14.246</server-name> <user>db2inst1</user> <password>db2inst1</password> <property> <name>driverType</name> <type>java.lang.Integer</type> <value>4</value> </property> <connection-pool> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> <check-query> SELECT COUNT(*) FROM SYSIBM.SYSTABLES </check-query> <keep-connection-handle-open>true</keep-connection-handle-open> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
DB2 Type 2 드라이버를 사용하기 위해서는 DB2 클라이언트를 설치하여 DB Alias를 설정한 뒤, JEUS 실행 스크립트(JEUS_HOME/bin/jeus 또는 jeus.bat)에서 -Djava.library.path 또는 시스템의 라이브러리 경로에 DB2 클라이언트의 네이티브 라이브러리 경로를 설정해야 한다. 다음의 예제에서 <database-name>이 DB Alias가 되고 DB2 서버 주소와 포트 번호는 입력할 필요가 없다.
[예 B.7] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>db2</vendor> <export-name>db2_xa1</export-name> <data-source-class-name> com.ibm.db2.jcc.DB2XADataSource </data-source-class-name> <data-source-type>XADataSource</data-source-type> <database-name>TEST1</database-name> <user>db2inst1</user> <password>db2inst1</password> <connection-pool> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.8] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>sybase</vendor> <export-name>sybasedatasource</export-name> <data-source-class-name> com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource </data-source-class-name> <data-source-type> ConnectionPoolDataSource </data-source-type> <database-name>testdb</database-name> <port-number>5000</port-number> <server-name>192.168.1.10</server-name> <user>sa</user> <password>sybase</password> <property> <name>networkProtocol</name> <type>java.lang.String</type> <value>Tds</value> </property> <connection-pool> <pooling> <min>10</min> <max>50</max> <step>5</step> <period>600000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.9] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>sybase</vendor> <export-name>XAsybase</export-name> <data-source-class-name> com.sybase.jdbc3.jdbc.SybXADataSource </data-source-class-name> <data-source-type> XADataSource</data-source-type> <database-name>testdb</database-name> <property> <name>networkProtocol</name> <type>java.lang.String</type> <value>Tds</value> </property> <port-number>5000</port-number> <server-name>192.168.1.11</server-name> <user>sa</user> <password>sybase</password> <connection-pool> <pooling> <min>10</min> <max>50</max> <step>5</step> <period>600000</period> </pooling> <wait-free-connection> <enable-wait>true</enable-wait> <wait-time>10000</wait-time> </wait-free-connection> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.10] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>mssql</vendor> <export-name>mssqldatasource</export-name> <data-source-class-name> com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource </data-source-class-name> <data-source-type> ConnectionPoolDataSource </data-source-type> <database-name>jeusdb1</database-name> <port-number>1411</port-number> <server-name>192.168.14.252</server-name> <user>jeusdb1</user> <password>jeusdb1</password> <connection-pool> <pooling> <min>5</min> <max>10</max> <period>3600000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
ODBC 설정은 JDBC보다 먼저 설정되어야 한다.
[예 B.11] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>informix</vendor> <export-name>informix_pool1</export-name> <data-source-class-name> com.informix.jdbcx.IfxConnectionPoolDataSource </data-source-class-name> <data-source-type>ConnectionPoolDataSource</data-source-type> <database-name>skynps</database-name> <port-number>2002</port-number> <server-name>ids93fc</server-name> <user>informix</user> <password>informix</password> <property> <name>IfxIFXHOST</name> <type>java.lang.String</type> <value>192.168.1.43</value> </property> <connection-pool> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.12] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>tibero</vendor> <export-name>tibero_pool1</export-name> <data-source-class-name> com.tmax.tibero.jdbc.ext.TbConnectionPoolDataSource </data-source-class-name> <data-source-type>ConnectionPoolDataSource</data-source-type> <database-name>tibero</database-name> <port-number>4545</port-number> <server-name>192.168.14.247</server-name> <user>jeusdb1</user> <password>jeusdb1</password> <property> <name>driverType</name> <type>java.lang.String</type> <value>thin</value> </property> <connection-pool> <pooling> <min>10</min> <max>20</max> <period>3600000</period> </pooling> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>
[예 B.13] <<JEUSMain.xml>>
<jeus-system> . . . <resource> <data-source> <database> <vendor>mysql</vendor> <export-name>mysql_pool1</export-name> <data-source-class-name> com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource </data-source-class-name> <data-source-type>ConnectionPoolDataSource</data-source-type> <database-name>test</database-name> <port-number>3306</port-number> <server-name>192.168.1.11</server-name> <user>tester</user> <password>tester</password> <connection-pool> <pooling> <min>2</min> <max>10</max> <step>1</step> <period>3600000</period> </pooling> <wait-free-connection> <enable-wait>true</enable-wait> </wait-free-connection> <check-query>select 1</check-query> <check-query-period>30000</check-query-period> </connection-pool> </database> . . . </data-source> . . . </resource> </jeus-system>