要关的
先关闭statement,再关闭connection

解决方案 »

  1.   

    先关闭statement,再关闭connection如果线程结束,statement可以不关,自动无效了!
      

  2.   

    要关的 !先关闭statement,再关闭connection 
      

  3.   

    昨儿查的jdbc的文档,说conn关闭了,statement也就关闭了. 这个从哪儿查得,我从jdk的文档中没有查到conn关闭了,statement也就关闭了,只是说statement关闭了,当前的resultset会被自动关闭的。
      

  4.   

    没有这样的啊!~!conn关闭以后跟statement好像没有关系吧~!
    时conn关闭以后,statement也不起做用了而已!~!
    所以在平常我们只用关闭conn就可以了!~!
    如果做得细致的话就可以关闭statement,
    但是我还是建议只要关闭conn就可以了!~!
    呵呵
      

  5.   

    All Statement objects will be closed when the connection
    that created them is closed. However, it is good coding practice for applications to
    close statements as soon as they have finished processing them. This allows any
    external resources that the statement is using to be released immediately.jdbc3.0文档上的原话
      

  6.   

    兄弟    文档上说的是对的  jdbc connection关闭后 statement是会跟着关闭的  但用了连接池之后  获得的connection 你调用它的关闭方法  它并不会真的关闭  而是将这个连接返回给连接池中  以备后面你用了再从池里再拿   所以你的statement也就当然没关了