File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Garbage collection in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Garbage collection in JDBC" Watch "Garbage collection in JDBC" New topic

Garbage collection in JDBC

pradeep andhra

Joined: Sep 18, 2006
Posts: 9
Hi Ranchers,

I am doing a JProbe testing on a use-case. Inspite of closing all open resources (resultset and PreparedJDBCStatement) , the snapshot(Jprobe) reports instances of OracleStatement on the heap. The memory of this is considerably high . I wish to know why these instances were not garbage collected by the JVM. The application uses Oracle type 4 driver.

The instance view detail lists a number of
T4CNumberAccessorXXXXXXX(rowSpaceChar). What is this?

Requesting replies ASAP!. Thanks in advance

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Did you close the database connections themselves?

I think your issues might fall under the category of general garbage collection such as is there still a reference to these objects anywhere in the system, have you tried calling System.gc() after making large calls, and are trying to load more data into memory than available.

Also, have you tried using connection pooling?

[OCA 8 Book] [Blog]
pradeep andhra

Joined: Sep 18, 2006
Posts: 9
Hi Scott,

Yes I am using connection pooling here and regarding System.gc(), I believe Jprobe itself will force a GC on the use-case before collecting the snapshot. Even the resources are explicitly closed.

I agree. Here's the link:
subject: Garbage collection in JDBC
It's not a secret anymore!