结果结都要关闭
rs.close();
stmt.close();
Connection.close();

解决方案 »

  1.   

    为什么要这么做呢?
    查询一次全部取出存到容器里 
    然后关闭就行了.
    在连接bean里写.executeQuery返回ArrayList or [][]不用重新创建连接池!至少我没遇过你的问题.
      

  2.   

    resultSet用完後要關閉
    connection用完後要free釋放。
      

  3.   

    如果是你自己写的连接池,就不要使用Statement,改为使用PreparedStatement就可以了
    如果你使用的是oracle的话,建议你使用oracle的连接池
    import java.sql.*;         // Package for JDBC core API
    import javax.sql.*;        // Package for JDBC extension API
    import oracle.jdbc.pool.*;public class TestPool{
    public static void main(String []str){
    PooledConnection  m_connectionPool;
    try {
    OracleConnectionPoolDataSource l_ocpds =
                                              new OracleConnectionPoolDataSource();        // Set connection parameters
            String l_url = "jdbc:oracle:thin:@192.168.101.54:1521:cmcdevp";        // Sets the connection URL
            l_ocpds.setURL(l_url);        // Sets the user name
            l_ocpds.setUser("cmcreal");        // Sets the password
            l_ocpds.setPassword("cmcreal");        // Create a  connection  pool
            m_connectionPool = l_ocpds.getPooledConnection();        if (m_connectionPool != null )
                System.out.println("Connection Pool Created");
                
            // get a  connection 
            Connection con = m_connectionPool.getConnection();
            if(con!=null){
                System.out.println("Connection Created");
            }
            

    }catch (Exception e){
    e.printStackTrace();
    } finally {

    }
    }
    }
      

  4.   

    http://forum.java.sun.com/thread.jsp?thread=365156&forum=48&message=1539251