rs的资源没有释放,等待Garbage Collector来收集。

解决方案 »

  1.   

    关键是:
    数据库cursor资源将被慢慢耗尽!
      

  2.   

    CoolAbu:好像是这样的。但为什么都喜欢用rs/stmt.close()呢,用与不用有什么区别,那种用法好些
      

  3.   

    最好再加上rs = null; stmt = null;
      

  4.   

    感觉这样比较合适:
    if ( rs != null )
          {
            try
            {
              rs.close () ;
            }
            catch ( Exception ex )
            {}
          }      if ( stm != null )
          {
            try
            {
              stm.close () ;
            }
            catch ( Exception ex )
            {}
          }      if ( conn != null )
          {
            try
            {
              conn.close () ;
              System.out.println ( "conn.close" ) ;
            }
            catch ( Exception ex )
            {}
          }
      

  5.   

    正确的释放资源顺序应该是:
    result.close();
    statement.close();
    connection.close();
      

  6.   

    大家是否遇到过这种异常:
    Error Message: Connection reset by peer: socket write error
    Error Code: 500
    Target Servlet: null
    Error Stack: 
    java.net.SocketException: Connection reset by peer: socket write error 
         at java.net.SocketOutputStream.socketWrite(Native Method) 
         at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code)) 
         at com.ibm.ws.io.Stream.write(Stream.java(Compiled Code))