* 예전 블로그 복사 - http://blog.daum.net/7dbwnckd/1616426
이번에 다시 sql과 연동을 시도하면서 새로운 문제에 부딪히게 되었는데~
예전 처럼(Tomcat 5.0) 시도하면 Tomcat 시작 시 Warning이 뜨게 된다.
따라서 다른 방법으로 시도해야 하는데~
바로... 아래와 같다.
* 각각의 context밑의 web.xml의 설정
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>
JSP 2.0 Examples.
</description>
<display-name>JSP 2.0 Examples</display-name>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/dbwnckd</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
* 각각의 context밑의 context.xml의 설정
<Context path="" docBase="emergency" debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_emergency_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/dbwnckd"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="root"
password="admin"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mysql?autoReconnect=true"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>