首页 → 数据库技术
背景:
阅读新闻
tomcat6添加mysql的jndi数据源
[日期:2012-12-28]来源:linux社区 作者:dc_726[字体:]
1. 添加jndi配置文件到工程下
xmlns:xsi=http://www.w3.org/2001/xmlschema-instance xmlns:aop=http://www.springframework.org/schema/aop
xmlns:tx=http://www.springframework.org/schema/tx xmlns:jdbc=http://www.springframework.org/schema/jdbc
xmlns:context=http://www.springframework.org/schema/context
xmlns:util=http://www.springframework.org/schema/util>
2. 在tomcat中添加数据库连接配置,,具体位置是:tomcat安装目录下/conf/context.xml
要注意的是:name要和上面spring配置文件中的jndiname中java:comp/env的后半段对应。
auth=container type=javax.sql.datasource
password=test username=test
driverclassname=com.mysql.jdbc.driver
url=jdbc:mysql://192.168.229.97:3306/test
maxactive=100 maxidle=30 maxwait=5000/>
3. 将mysql的jdbc驱动mysql-connector-java-5.1.6.jar添加到tomcat的lib目录,否则tomcat会报出找不到驱动类的异常。
0
mysql自动关闭连接导致dbcp报错
mysql删除binlog日志及日志恢复数据的方法
相关资讯 tomcat tomcat6 jndi数据源 jndi数据源
图片资讯
本文评论查看全部评论 (0)
评论声明
最新资讯
本周热门
linux公社简介 - 广告服务 - 网站地图 - 帮助信息 - 联系我们
本站(linuxidc)所刊载文章不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。
copyright © 2006-2014 linux公社 all rights reserved 浙icp备06018118号