OracleConnectionCacheImpl connPool = new OracleConnectionCacheImpl();
connPool.setURL(url);
connPool.setUser(username);
connPool.setPassword(password);
connPool.setMaxLimit(size);Connection conn = connPool.getConnection();try{
conn.createStatment();
st.executeQuery(sql);
.
.
.
catch(SQLException e){}finnally{//这句有必要写吗?或者有什么其他的处理方法?
conn.close();
.
.
.
}
另外,在使用这样的方式后,容易出现“关闭的连接”的错误。不知是什么原因。
connPool.setURL(url);
connPool.setUser(username);
connPool.setPassword(password);
connPool.setMaxLimit(size);Connection conn = connPool.getConnection();try{
conn.createStatment();
st.executeQuery(sql);
.
.
.
catch(SQLException e){}finnally{//这句有必要写吗?或者有什么其他的处理方法?
conn.close();
.
.
.
}
另外,在使用这样的方式后,容易出现“关闭的连接”的错误。不知是什么原因。
解决方案 »
- 事务2包含在事务1中,如何实现事务1回滚时,事务2也回滚
- struts+jdbc中文乱码问题!
- 关于window.open()请求servlet的问题
- hibernate 的 application里面 sessionFactory实例化问题
- 请教一个关于axis应用的难问题
- 在struts中使用复选框的问题
- struts问题-ActionForm中的reset()方法何时被调用
- 有谁用WEBLOGIC8.0吗?我安装了一个,找不到北,怎么跟8.0差别这么大??大家说说看自己的想法,哪里可以找到相关资料!
- 请教怎样用j2ee的deploytool工具,把我的bean的属性值映射到本地sqlserver2k的数据库中??谢谢
- java编译时报错:找不到符号;
- hibernate问题4
- 关于 java中的 无限级分类 javabean 在hibernate中的映射配置
因为你用的是连接池. conn.close() 只会告诉连接池资源可以回收了.
如果池子size是4,不关闭connection,申请4次后,你的池子就废了。