/********** 한글처리
********** /
server.xml
<Connector ... URIEncoding="UTF-8" />
web.xml
가장 위에 놓는다.
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>
org.apache.catalina.filters.SetCharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
/
********** jndi **********/
context.xml
<Resource name="oracleDS" auth="Container" type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@ip:port:sid"
username="scott" password="tiger" maxActive="20" maxIdle="10" maxWait="-1"
/>
<Resource name="db2DS" auth="Container" type="javax.sql.DataSource"
driverClassName="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://ip:port/dbname"
username="" password="" maxActive="20" maxIdle="10" maxWait="-1"
/>
web.xml
<resource-ref>
<description>Oracle Datasource </description>
<res-ref-name>oracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>DB2 Datasource example</description>
<res-ref-name>db2DS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
java
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("oralceDS");
conn = ds.getConnection();