db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Briggs <acidbri...@gmail.com>
Subject Re: Iterating through large result set in network mode causes OutOfMemoryException
Date Mon, 11 Feb 2008 18:22:38 GMT
Yes, I meant the server.  Sorry.  But, it's my application that causes
it (the server) to fail.

> The app?  Your first posting indicated that the server ran out of memory.

> > Also, the occasional commit is also causing a problem.  I end up
> > eventually getting this:
> >
> > java.sql.SQLException: The data in this BLOB or CLOB is no longer
> > available.  The BLOB/CLOB's transaction may be committed, or its
> > connection is closed.
>

Well, I am only calling commit after I have read the blob and pulled
all data from it. So, the strange issue is that I can get back a bunch
of records (and I am calling commit() after I retrieve all the data
from the current curror) then call ResultSet#next(). So, I am getting
through a bunch, but eventually the SQLException pops up.  I know it's
not good for performance to call commit() after every result, but I am
just testing.

So, I basically test this like:

while(rs.next()) {
     final String content;
     content = blobToString(rs.getBlob("content"));
     conn.commit();
}

//very rudimentary method to convert to a string
private String blobToString(final Blob blob) throws SQLException{
   final byte[] bytes;
   final String result;

    //not worried about the length at the moment, we don't store data that
    //large in our application, max is 64K
   bytes = new byte[(int)blob.length()];
   result = new String(bytes);

   blob.free();

   return result;
}

That's the jist.  Still trying to figure out why that didn't work.

Again, thanks for all your time.  Great list of people here!

> A Blob/Clob object is not valid after the transaction it was created in
> has committed.
>
> --
> Øystein
>



-- 
"Conscious decisions by conscious minds are what make reality real"

Mime
View raw message