0

I'm having a problem saving large text files to MySQL database. If the text file size is around 5KB it successfully saves. If file is 148KB then I get this error from Hibernate:

org.hibernate.exception.DataException: Could not execute JDBC batch update

These is the SQL shows by Hibernate:

Hibernate: insert into file_table (ID,FILE) values (?, ?)

And in my hibernate file I'm using java.sql.Blob to store the file.

Anyone knows why it fails to save a file size of 148KB but if I open that same file, cut it down to around 5KB, it will successfully save it?

I thought the default limit was I think 2GB? This is weird.

Thanks.

1 Answer 1

1

Here is an explanation of the maximum length for different string columns in mysql:

http://dev.mysql.com/doc/refman/5.1/en/string-type-overview.html

A standard TEXT column only allows 65,535 characters max, you probably want a LONGTEXT column which allows around 4Gb per column.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I previously had BLOB in database. I changed in database to LONGBLOB and it work!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.