我是否需要关闭PreparedStatement [英] Do I need to close PreparedStatement
问题描述
我有一个网站获得大量点击,我遇到问题,JDCB连接错误。
I have a website which is getting a massive number of hits, I'm experience problems, JDCB connection errors.
我对关闭感到有些困惑code> PreparedStatement ,我是否需要关闭 PreparedStatement
,否则它就足以关闭 Statement $ c仅限$ c>。
I'm a bit confused about closing PreparedStatement
, do I need to close PreparedStatement
or it's just enough to close Statement
only.
另外, ResultSet
怎么样,我需要关闭它吗?
Also, what about ResultSet
, do I need to close it to?
推荐答案
是的,您必须关闭预备语句和结果集,因为它们可能会导致内存泄漏。
欲了解更多信息,
http://docs.oracle.com/ javase / tutorial / jdbc / basics / prepared.html
Yes you have to close the preparedstatements and resultsets as they may cause memory leakage. For more info, http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
这篇关于我是否需要关闭PreparedStatement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!