我是否需要关闭PreparedStatement [英] Do I need to close PreparedStatement

查看:881
本文介绍了我是否需要关闭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

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆