连接没有关闭,导致连接池已满。你的程序有点问题。看一下。

解决方案 »

  1.   

    我是写在Beans里的
    public DBcon() throws  Exception
      {
         Context initCtx = new InitialContext();
         if (initCtx == null)
           throw new Exception("不能获取Context!");
         Context ctx = (Context) initCtx.lookup("java:comp/env");
            //获取连接池对象
         Object obj = (Object) ctx.lookup("jdbc/mysql");
           //类型转换
         javax.sql.DataSource ds = (javax.sql.DataSource) obj;
         conn = ds.getConnection();
        // stmt = conn.createStatement();  }
      public Connection getConnect()
      {
              return conn;
      }