I would follow Stephen's suggestions as he is right. You might bewaiting on a free connection to the database as your program loopsthrough the records. If that doesn't help then I can make asuggestion that you explicitly call the gc System.gc();