This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
The first thing that stands out in your code is that you are allocating a byte array with 50 million bytes in line 9. It looks like you read in a file in lines 12-27 into a byte array, resizing and copying the array to make it larger if the file is even bigger. If you read in a really large file (tens or hundreds of megabytes or bigger) then this can easily lead to an OutOfMemoryError.
To avoid this you could start the JVM with the -Xmx parameter to allow it to allocate more memory. For example: java -Xmx512M org.mypackage.MyProgram will allow it to allocate up to 512 MB RAM.
However, that only taking away the symptom. It would be better to rewrite that code so that it isn't necessary to read the data for the blob into a large buffer in memory. I don't know exactly how to do it right now but as far as I know, when you want to insert a blob in the database, you do not need to have the data in memory - you can pass it an InputStream (for example a FileInputStream) and the JDBC driver will read the data from there to insert it into the database.