这当然是个stupid的问题
可是ResultSet只是一个资源,有必要close吗?
当然如果说ResultSet对象,那么会占用服务器的资源,如果没有close()
不释放就意味这ResultSet对象一直驻守在内存,这个角度理解对吗
有人告述我ResultSet对象意味着游标的存在
游标也意味着资源,有点象指针,
java不说也对不用的变量要显式的置为null吗?
这个角度理解对吗?
可是ResultSet只是一个资源,有必要close吗?
当然如果说ResultSet对象,那么会占用服务器的资源,如果没有close()
不释放就意味这ResultSet对象一直驻守在内存,这个角度理解对吗
有人告述我ResultSet对象意味着游标的存在
游标也意味着资源,有点象指针,
java不说也对不用的变量要显式的置为null吗?
这个角度理解对吗?
解决方案 »
- 正则问题
- 共同讨论类成员初始化顺序的问题
- 对象和类
- 没安装jre的电脑能运行JAVA程序么?
- java ip地址问题.
- 课后作业题目——很简单的!
- 我什么提示我的applet的程序没初始化
- 为什么在try...catch块中定义的局部变量不能被。。。
- JAVA与中文问题???(中文出来就是乱码,换英文就正常)
- 封装google -- protobuf
- java.sql.connection是不是线程安全的?我想整个应用中只创建一个connection
- 进过这个的http://community.csdn.net/Expert/topic/4457/4457136.xml?temp=.9987757大虾来jf
文档中说得很清楚了:
A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet object is also automatically closed when it is garbage collected
文档中说得很清楚了:
A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet object is also automatically closed when it is garbage collected
re-executed, or used to retrieve the next result from a sequence of multiple results.
这是jdk上的原话,说实话,这句话我连语法都不是很懂generated是修饰谁呢?
当然,我们肯定会理解为the Statement object generate A ResultSet object
那么这句化的意思就是
当the Statement object close时,那么其对应的 A ResultSet object也自动close
那么我的理解就是如果执行拉StateMentObject.close(),那么自动ResultSetObject.close()
好像肯定不对,那又该如何理解呢
期待大虾指正之
--
如果Statement对象close的话,那么由它产生的ResultSet对象将自动close.