How to put some object like string or image from database using java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to put some object like string or image from database using java

I have try to put some object like string and image in jtable. but for image i have trouble, i can retrieve image from database in java. so many solution i have tried. but i dont have any good solution. can you help me, how to put image from database in jtable using java. please help me

30th Apr 2018, 3:40 AM
Nazhan Harzula
Nazhan Harzula - avatar
1 Answer
+ 4
When it comes to images and databases generally you will either just save the path data to the image or save the image to the database as a blob. Saving the path is fairly simple and can be done in a similar manner to saving any other string. When saving the image as a blob you must first convert the image to a blob or binary stream. An image saved in this form cannot be directly viewed when retrieved from the database, but must first be converted from a blob back to an image and usually saved somewhere temporarily. Here are a couple of examples: https://www.thecrazyprogrammer.com/2016/01/save-and-retrieve-image-from-mysql-database-using-java.html https://www.javatpoint.com/retrieving-image-from-oracle-database
30th Apr 2018, 5:43 AM
ChaoticDawg
ChaoticDawg - avatar