please subscribe your issue more detail.

解决方案 »

  1.   

    是这样我要连接sqlserver的数据库
    本来连接没有问题
    但不知为什么现在突然过一段时间就会出错,出错信息就是上面所提示的。
      

  2.   

    可能是你执行完sql没有及时关闭连接,超出连接池限制了吧!你检查以下代码,或者把你的操作数据库的代码贴上。
      

  3.   


     SqlDataSource = (DataSource)ic.lookup("SQLServer");//系统话务量统计合计查询
            public String[][] getHWLHJStatValues(String beginTime,String endTime)
           {
                   Connection conn = null;
                   PreparedStatement pstmt = null;
                   ResultSet rs = null;
                   try
                   {
                           conn = SqlDataSource.getConnection();
                           pstmt = conn.prepareStatement("SELECT COUNT(DISTINCT ANI) FROM t_Termination_Call_Detail");
                           rs = pstmt.executeQuery();
                           rs.next();
                           int rowCount = rs.getInt(1);
                           rs.close();
                           pstmt.close();
                           pstmt = conn.prepareStatement("SELECT ANI,DNIS,COUNT(*) AS TalkNum,SUM(Duration) AS Duration FROM t_Termination_Call_Detail WHERE DateTime >= CONVERT(DATETIME,'" + beginTime + "') AND DateTime <= CONVERT(DATETIME,'" + endTime + "') GROUP BY ANI,DNIS");
                           rs = pstmt.executeQuery();
                           String[][] values = new String[rowCount][4];
                           for (int i = 0; i < rowCount; i++)
                           {
                                   rs.next();
                                   values[i][0] = rs.getObject(1)==null?" ":rs.getObject(1).toString();
                                   values[i][1] = rs.getObject(2)==null?" ":rs.getObject(2).toString();
                                   values[i][2] = rs.getObject(3)==null?" ":rs.getObject(3).toString();
                                   values[i][3] = rs.getObject(4)==null?" ":rs.getObject(4).toString();
                           }
                           return values;
                   }
                   catch(SQLException e)
                   {
                           throw new EJBException(e);
                   }
                   finally
                   {
                           if (rs != null)
                                   try { rs.close(); } catch(SQLException ignore) {}
                           if (pstmt != null)
                                   try { pstmt.close(); } catch(SQLException ignore) {}
                           if (conn != null)
                                   try { conn.close(); } catch(SQLException ignore) {}
                   }
            }
    这个问题不是超出连接池时提出的错误把