Should java.sql.Array / Blob / Clob types be "free ()"?

Do I need an explicit call to free() in arrays, clobs, etc. or closing a ResultSet and / or Statement will automatically take care of this? Javadok does not say anything, so I assume that this is not necessary, but I would not want to make the wrong assumption.

Also, if it’s not necessary, is it a good idea if you close the result set right away? I could see how this can help if you do not.

+7
source share
1 answer

It depends on the version of Vendor and JDBC you are using. Since all database providers do not support Array (e.g. MySQL)

And that could be the reason. Why dzhavadok does not say anything.

I found this tutorial Using an Array object on an oracle site on a JavaSE site, which says that releasing resources explicitly.

Here is another link that illustrates the free() script. The java.sql.Clob.free () method of JDBC 4 and backward compatibility

if it’s not necessary, is it a good idea if you are going to close the result right away?

I think that then you do not need to free (), but then again, if its a long transcon, then it is useful to call free ().

Quote from tutorial :

Array objects remain valid for at least the duration of the transaction in which they are created. This can result in an application that has run out of resources for a long time transaction. Applications can free array resources by calling their free method.

+2
source

All Articles