Tomcat5.5下配置Access、MySQL、MS Server的数据库连接池配置

注意:本配置说明只针对Tomcat5.5

1、MySQL的数据库连接池的配置
在<Host></Host>之间添加
<Context docBase="test" path="/test">
      <Resource name="jdbc/test" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" maxIdle="100" maxWait="5000" username="root" password="xxll19850515" url="jdbc:mysql://localhost:3306/test" maxActive="4"/>
  </Context>

在web.xml中添加
<resource-ref> 
  <description>DB Connection</description> 
  <res-ref-name>jdbc/test</res-ref-name> 
  <res-type>javax.sql.DataSource</res-type> 
  <res-auth>Container</res-auth> 
  </resource-ref>


2、MSSQL server2000数据库连接池的配置
在<Host></Host>之间添加
<Context docBase="test" path="/test">
      <Resource name="jdbc/leagu" type="javax.sql.DataSource" driverClassName="com.jnetdirect.jsql.JSQLDriver" maxIdle="100" maxWait="5000" username="sa" password="123" url="jdbc:JSQLConnect://localhost:1433/database=league" maxActive="4"/>
  </Context>

在web.xml中添加:
<resource-ref> 
  <description>DB Connection</description> 
  <res-ref-name>jdbc/leagu</res-ref-name> 
  <res-type>javax.sql.DataSource</res-type> 
  <res-auth>Container</res-auth> 
  </resource-ref>

3、Access数据库的数据源配置

注意:在配置数据源时必须选择系统DSN,否则无法成功,因为tomcat访问数据源不是用当前用户进行访问。
在<Host></Host>之间添加
<Context docBase="test" path="/test">
      <Resource name="jdbc/leagu" type="javax.sql.DataSource" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" maxIdle="100" maxWait="5000" username="" password="" url="jdbc:odbc:leagu" maxActive="4"/>
  </Context>
在web.xml中添加:
<resource-ref> 
  <description>DB Connection</description> 
  <res-ref-name>jdbc/leagu</res-ref-name> 
  <res-type>javax.sql.DataSource</res-type> 
  <res-auth>Container</res-auth> 
</resource-ref>

 

posted @ 2010-11-10 15:14  傲雪迎风  阅读(578)  评论(0)    收藏  举报