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.
An SQL CLOB is a built-in type that stores a Character Large Object as a column value in a row of a database table. By default drivers implement a Clob object using an SQL locator(CLOB) , which means that a Clob object contains a logical pointer to the SQL CLOB data rather than the data itself.
To read from a CLOB, use the getAsciiStream() or getCharacterStream() method of an oracle. sql. CLOB object to retrieve the entire CLOB as an input stream. The getAsciiStream() method returns an ASCII input stream in a java.
BLOBs are used to store binary information, such as images, while CLOBs are used to store character information. BLOBs and CLOBs can store up to 4 Gigabytes of data (the limit imposed by the JDBC and ODBC specifications).
The JDBC API is a constituent technology of the Java platform. The JDBC 3.0 API should be aligned with the overall direction of the Java 2 Enterprise Edition and Java 2 Standard Edition platforms.
It depends on the Vendor and JDBC version you are using. As all databse vendors do not support Array(e.g. MySQL)
And this could be the reason Why the javadoc doesn't say anything.
I have found this tutorial Using Array Object on oracle site's JavaSE tutorials which says to release resources explicitly.
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With