一、配置
3
30
1000
false
Test
false
100
null
false
60
3
60
15
100
3
root
password
select id from test where id=1
300
false
true
root
false
con_test
30000
30
10
30
25
10
0
200
300
二、实现
c3p0的实现
全局使用c3p01. server.xml中GlobalNamingResources
2. context.xml中ResourceLink
3. web.xmlTomcat Datasourcejdbc/mysql1javax.sql.DataSourceContainer
4.Hibernate中的配置
51001800100
org.hibernate.dialect.MySQLDialectjdbc:mysql://localhost:3306/noticemanagerjava:comp/env/jdbc/mysql1rootxxxxxxxxxtrue
JDBC实现:与DateSource相同
try {Context ctx = new InitialContext();ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mysql1");conn = ds.getConnection();} catch (NamingException e) {e.printStackTrace();return null;
} catch (SQLException e) {e.printStackTrace();return null;}
版权声明:本文为weixin_36198673原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。