aspose file tools*
The moose likes JDBC and the fly likes Inserting image to MySQL Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inserting image to MySQL Database" Watch "Inserting image to MySQL Database" New topic
Author

Inserting image to MySQL Database

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Dear Ranchers,

I have a mysql database table called hrms_photo. The table details are shows below


I have the following program for uploading the image to MySQL database.



When I run the program, I cannot insert the image which is larger than 50KB. In the log file, I'm getting the error like this



Please help me to sort this issue Ranchers..

Thanks/Regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

YOu probably want to swap to a larger BLOB data type if you are hitting the limit. MySQL also has mediumblob and largeblob.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Thankyou Mr.Paul Sturrock ,

I have put mediumblob and it worked fine. But I couldn't find LargeBlob.. Please advise.

Thanks/Regards
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sorry, my mistake. Its called longblob.
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Thankyou very much!!

Regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

This is also a MySQL setting. I tried your code, but a) it's limit is 64KB on my machine, and b) it just truncated without aborting.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inserting image to MySQL Database