日期:2014-05-18  浏览次数:20691 次

Tomcat数据库链接池问题
tomcat连接池问题,关闭所有的tomcat连接池链接,为什么还有数据库链接存在。
tomcat连接池配置
<Context   path= "/UltraProcess "   docBase= "C:\javaworkplace\Proto\UltraProcess "   debug= "0 "   reloadable= "true ">
<Resource  
name= "jdbc/duty "
auth= "Container "  
type= "javax.sql.DataSource "
password= "duty "
driverClassName= "oracle.jdbc.driver.OracleDriver "
maxIdle= "10 "
maxWait= "5000 "
username= "duty "
url= "jdbc:oracle:thin:@127.0.0.1:1521:OMS "
maxActive= "0 "/>
<Resource  
name= "jdbc/remedy "
auth= "Container "  
type= "javax.sql.DataSource "
password= "AR#ADMIN# "
driverClassName= "oracle.jdbc.driver.OracleDriver "
maxIdle= "10 "
maxWait= "5000 "
username= "ARADMIN "
url= "jdbc:oracle:thin:@127.0.0.1:1521:OMS "
maxActive= "0 "/>

</Context>

<Context   path= "/UltraProcess1 "   docBase= "C:\javaworkplace\Message\UltraProcess "   debug= "0 "   reloadable= "true ">
<Resource  
name= "jdbc/duty "
auth= "Container "  
type= "javax.sql.DataSource "
password= "duty "
driverClassName= "oracle.jdbc.driver.OracleDriver "
maxIdle= "10 "
maxWait= "5000 "
username= "duty "
url= "jdbc:oracle:thin:@127.0.0.1:1521:OMS "
maxActive= "0 "/>
<Resource  
name= "jdbc/remedy "
auth= "Container "  
type= "javax.sql.DataSource "
password= "AR#ADMIN# "
driverClassName= "oracle.jdbc.driver.OracleDriver "
maxIdle= "10 "
maxWait= "5000 "
username= "ARADMIN "
url= "jdbc:oracle:thin:@127.0.0.1:1521:OMS "
maxActive= "0 "/>
</Context>


链接池的关闭代码

public   static   void   closeResultSet(ResultSet   rs){
if   (rs   ==   null)  
return;
 

Statement   stmt   =   null;

try   {
stmt   =   rs.getStatement();
}   catch   (Exception   e)   {
throw   new   RuntimeException( "关闭游标失败!! ");
}   finally   {
try   {
rs.close();
if   (stmt   !=   null)   {
stmt.close();
}
}   catch   (Exception   e)   {
}
}
}

}


那位大虾帮我看看啊

------解决方案--------------------
要close rs,要close stmt,要close con。
先后顺序也不要搞乱了。
------解决方案--------------------
只关闭了Result和Statement,没有关闭Connection,数据库连接当然还会存在