jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes PreparedStatement, setBinaryStream, and outOfMemoryError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PreparedStatement, setBinaryStream, and outOfMemoryError" Watch "PreparedStatement, setBinaryStream, and outOfMemoryError" New topic
Author

PreparedStatement, setBinaryStream, and outOfMemoryError

Hans Solo
Greenhorn

Joined: Jul 25, 2006
Posts: 2
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreparedStatement, setBinaryStream, and outOfMemoryError