当然没有关闭了,你要执行connection.close(),不过要先执行ResultSet.close(); Statement.close();

解决方案 »

  1.   

    好像只要connection.close()就OK了吧ResultSet.close()和Statement.close()是不是可以省略?
      

  2.   

    好像只要connection.close()就OK了吧ResultSet.close()和Statement.close()是不是可以省略?
      

  3.   

    不用关闭connection,如果你用sql server监视连接数的话,如果connection.close(),连接数肯定会减少的,这是显式关闭。就不能称为连接池了。weblogic会自动把conn放到连接池内,供其它程序再次获得
      

  4.   

    到底怎么样呢 难道连接后就不用管了吗  我显式的用connection.close()关闭了连接池  好像问题还是存在呀  以下是我的连接池代码 
         public  Statement getConnection()
         {
           Statement  stm = null;
           DataSource ds = null;
           InitialContext ctx = null;
           try{
             ctx = new InitialContext();
             ds = (DataSource)ctx.lookup("dingfan");
             Connection con = ds.getConnection();
             stm = con.createStatement();
           }catch(SQLException jsqlex)
           {
             jsqlex.printStackTrace();
           }catch(NamingException e){
           }
           return stm;
         }
    应该没什么问题吧