PreparedStatement, setBinaryStream, and outOfMemoryError

I'm trying to load very file files into a mysql db, and I'm frustrated. I set up a prepared statement, used setBinaryStream to input the file, and executed only to have the outOfMemoryError bite me.

My understanding given the javadoc is that using the setBinaryStream method will allow me to basically stream the file in rather than holding the entire thing in memory. I point at this line... "The data will be read from the stream as needed until end-of-file is reached"
in the javadoc

Here is the relevant code snippet.

What am I missing here?

Hans Solo
Greenhorn

Joined: Jul 25, 2006
Posts: 2

posted Jan 14, 2010 14:28:39

0

I should point out that the DB in question is MySQL. I believe that may be the problem, but I can't verify it past my assumption that the fault lies there.