Tomat 连接数据连接池
来源:互联网 发布:设计软件源码 编辑:程序博客网 时间:2024/05/17 16:53
在Tomcat 5.5/conf/Catalina/localhost/xxxxx.xml(xxxxx.xml为你自己的web的配置xml文件) 中添加resource
<Resource name="MYSQL"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
password="********"
maxIdle="2"
maxWait="5000"
username="root"
url="jdbc:mysql://localhost:3306/jnestore"
maxActive="10"/>
以上是tomcat 5.5版本的配置,5.5版本只有这样陪才有效果,以前的版本可以按照paramter的方法添加;
Resource 一定要包含在<Context ......> </Context> 之间
在你的web的路近下,WEB-INF中找到web.xml,添加资源映射
<resource-ref>
<description>connection</description>
<res-ref-name>MYSQL</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
把mysql的jdbc驱动.jar包放到tomcat的common/lib下去,也可以放到WEB-INF/lib下,
重新启动tomcat.
就可以用Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/MYSQL");
Connection con = ds.getConnection(); 来连接数据库连接池
- Tomat 连接数据连接池
- JDBC连接池(TOMAT-JDNI)
- 查看tomat并发连接
- 配置数据连接池
- weblogic数据连接池
- Jndi数据连接池
- 数据连接池配置
- 数据连接池
- 数据连接池
- 数据连接池配置文件
- 数据连接池
- 数据连接池
- 数据连接池
- 数据连接池+图解
- 数据连接池
- proxool数据连接池
- Java数据连接池
- 自定义数据连接池
- Javascript 实现连续可停止 滚动字幕
- Select Top在不同数据库中的使用用法
- 获取股票的瞬时图C#
- 读书笔记
- InflateRect
- Tomat 连接数据连接池
- SQL Server 2005中的T-SQL增强
- 对于追加数据必须有事务操作的补充
- sql server日期时间函数
- 谁收入最高?程序员收入大比拼(图)
- 关于Profile在App_Code文件夹中自定义类中的使用
- CVS安装配置与使用!(for Windows)
- Partial Classes and Methods
- 未将对象引用设置到对象的实例