jdk7+tomcat7,使用的tomcat连接池,配置如下:<?xml version="1.0" encoding="UTF-8"?>
<Context
    docBase="D:/webroot"
    reloadable="true">
  <Resource
    name="abcd/jdbcmssql"
    type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" 
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    password="1111"
    maxIdle="100"
    maxWait="10000"
    username="sa"
    url="jdbc:sqlserver://localhost:1433;DatabaseName=shop;SelectMethod=cursor"
    maxActive="5000"/>  <Resource
    name="bbbb/jdbcmssql"
    type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" 
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    password="111111"
    maxIdle="100"
    maxWait="10000"
    username="sa"
    url="jdbc:sqlserver://localhost:1433;DatabaseName=BaiduMap;SelectMethod=cursor"
    maxActive="5000"/>  <WatchedResource>D:\tomcat\conf\context.xml</WatchedResource>
</Context>

解决方案 »

  1.   

    INFO: Waiting for 253 instance(s) to be deallocated for Servlet [jsp]
    服务器阻塞了,和应用有关。
    先检查下是否和数据库的操作有关系(特别检查下资源使用完或者出错时有无释放)?再检查是否用了多线程?
      

  2.   

    肉眼是看不出来的。加 log,或者用内存监听工具
      

  3.   

    USE [shop]
    GO
    /****** Object:  StoredProcedure [dbo].[search_page_count]    Script Date: 05/16/2014 09:24:37 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GOALTER      proc [dbo].[search_page_count]
    @QueryStr  nvarchar(4000)='' /*查询语句*/
    as
    SET NOCOUNT ON/*-----这一句很重要哦:)),不然它只会认 insert #change......这个数据集:))*/
    declare @sql nvarchar(1000), --声明动态sql执行语句
    @Obj_ID int    --对象ID
    --处理查询语句
    select @Obj_ID=object_id(@QueryStr)
    ,@QueryStr=case when @Obj_ID is not null then ' '+@QueryStr else ' ('+@QueryStr+') a' end
    --取得当前数据库的记录总数
    begin 
    set @sql=N'select count(*) as rownum from '+@QueryStr
    exec sp_executesql @sql
    end在sql2008中这个存储过程有问题吗?统计记录条数的
      

  4.   

    以下这个数据库连接关闭的部分,有问题吗?public void close() {
            try{
                if(this.conn != null && this.conn.isClosed() == false)
                 this.conn.close();
            }catch(SQLException e){
                e.printStackTrace();
            }
            if(this.rsmd != null)
             this.rsmd = null;
            if(this.rs != null)
             this.rs = null;
            if(this.psmt != null)
             this.psmt = null;
            if(this.conn != null)
             this.conn = null;
        }
      

  5.   

    看楼主的描述,先从web服务器的连接池上分析,接着再看数据库。先看看服务器的日志有没有“报出某进程被当作死锁”,如果没有出现,那你换个连接池用c3p0或者dbcp试试。其它板块没影响,那你其它版块和那些打不开的版块是不同的表吗,如果是的话,即有可能是某个sql的查询所占时间太长再并发情况下出现死锁导致的。你也可以用sqlServer的sp_who_lock和sp_who2命令来查看你数据库的有没出现耗时长的导致死锁的sql进程,如果出现了,那就很麻烦了,这就要涉及到sql的优化表的索引优化,以及程序最好能用缓存避免并发造成负载过大