是否需要对java.sql.Array/Blob/Clob类型进行"free()"编辑? [英] Do java.sql.Array/Blob/Clob types need to be "free()"ed?

查看:252
本文介绍了是否需要对java.sql.Array/Blob/Clob类型进行"free()"编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否需要显式调用Arrays,Clobs等上的free(),还是关闭ResultSet和/或Statement会自动解决此问题? Javadoc没说什么,所以我认为这是没有必要的,但是我讨厌做出错误的假设.

Do I need an explicit to call free() on Arrays, clobs etc... or will closing the ResultSet and/or Statement automatically take care of this? The javadoc doesn't say anything, so I assume that it's not necessary, but I would hate to make an incorrect assumption.

如果不是必须的话,如果您要立即关闭结果集,这是一个好主意吗?如果您不这样做,我可以看到有什么帮助.

Also, if its not necessary, is it a good idea if you're going to close the result set right away? I could see how it might help if you're not going to do so.

推荐答案

这取决于您使用的Vendor和JDBC版本.由于所有数据库供应商都不支持Array(例如MySQL)

It depends on the Vendor and JDBC version you are using. As all databse vendors do not support Array(e.g. MySQL)

这可能是javadoc什么都没说的原因.

And this could be the reason Why the javadoc doesn't say anything.

我已找到本教程 使用数组对象 ,在oracle网站的JavaSE教程中说要显式释放资源.

I have found this tutorial Using Array Object on oracle site's JavaSE tutorials which says to release resources explicitly.

这是另一个链接,它说明free()上的情况. JDBC 4的java.sql.Clob.free()方法和向后兼容性

Here is another link which illustrates scenario of on free(). JDBC 4's java.sql.Clob.free() method and backwards compatibility

如果不需要的话,如果您要关闭 结果集马上出现?

if its not necessary, is it a good idea if you're going to close the result set right away?

我认为那么就不需要free()了,但是如果它长时间运行,那么再调用free()很好.

I think then there should not be required to free(),but again if its a long running transcation,then its good to call free().

教程引用:

Quoting from the tutorial:

数组对象至少在以下时间段内保持有效 创建它们的事务.这可能会导致 在长时间运行的资源不足的应用程序中 交易.应用程序可以通过调用来释放数组资源 他们的免费方法.

Array objects remain valid for at least the duration of the transaction in which they are created. This could potentially result in an application running out of resources during a long running transaction. Applications may release Array resources by invoking their free method.

这篇关于是否需要对java.sql.Array/Blob/Clob类型进行"free()"编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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