1首先要有相应的jdbc
2.用tomcat的控制台配置数据源。
3.到tomcat/conf下添加context。xml
内容如下:<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Resource    name="jdbc/mysql"    type="javax.sql.DataSource"    password="sa"    driverClassName="com.mysql.jdbc.Driver"    maxIdle="2"    maxWait="5000"    username="root"    url="jdbc:mysql://127.0.0.1/test"    maxActive="4" />

</Context>
4。配置你相应的项目的web。xml添加:
<resource-ref>
   <description>DB Connection</description>
   <res-ref-name>jdbc/mysql</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>   
   <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
Ok!

posted on 2006-12-14 11:11 yt 阅读(305) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

统计