
04-26-2008, 09:11 AM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 16
Rep Power: 0
|
|
java to mysql
Can anyone please give me a sample how to insert image to MySQL and retreiving it.
|
|

04-27-2008, 07:26 AM
|
 |
Senior Member
|
|
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 540
Rep Power: 3
|
|
|
What did Google said?
have you also post this in Database forum?
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
|
|

04-27-2008, 04:00 PM
|
|
Member
|
|
Join Date: Aug 2007
Posts: 20
Rep Power: 0
|
|
|
actually i'm not 100% pos but you cant actually store an image in a database, but you can store the name of it.
I.E.
Insert into X VALUES("myimage.jpg");
|
|

04-27-2008, 06:18 PM
|
 |
Senior Member
|
|
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 540
Rep Power: 3
|
|
|
Just a suggestion... im not sure if this is possible....
What if you will encode the image data in your own pattern...
eg. weird characters change to readable characters....
And store the encoded data in the database...
Maybe if implemented, you will expect more comparisons...
1 for encoder, also 1 for decoder....
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
|
|

04-28-2008, 06:28 AM
|
|
Member
|
|
Join Date: Aug 2007
Posts: 20
Rep Power: 0
|
|
|
the problem with encoding data to place into a database is selecting the right column datatype. Now it would be entirly possible to store an encrypted item in a database as long as you set it to nvarchar[MAX].
that makes it inefficiant though. Its better to store the image filename and just retrieve it.
|
|

04-28-2008, 06:44 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
|
|
|
In simple word convert the image into binaries and store it in a database as a image(image data type)
|
|

04-28-2008, 06:46 AM
|
|
Member
|
|
Join Date: Aug 2007
Posts: 20
Rep Power: 0
|
|
|
hrm interesting. Didn't know that there was an image data type.
|
|

04-28-2008, 07:55 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
|
|
Originally Posted by Rgfirefly24
|
|
hrm interesting. Didn't know that there was an image data type.
|
Yes it's pal. Really nice to use it. A long time ago I used it to store a text message in a database. Because message comes as a binary stream, and can't get characters from there.
|
|

04-28-2008, 08:15 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
|
|
|
You can store images into DB by converting images into byte streams.
__________________
sanjeev,संजीव
|
|

04-28-2008, 08:33 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
|
|
Originally Posted by sanjeevtarar
|
|
You can store images into DB by converting images into byte streams.
|
Yes, but the question is how to convert the image into bytes, using Java. DO you know a way Sanjeev.
Using C++, it's possible. We can work in a byte level.
|
|

04-28-2008, 08:41 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
|
|
Originally Posted by Eranga
|
Yes, but the question is how to convert the image into bytes, using Java. DO you know a way Sanjeev.
Using C++, it's possible. We can work in a byte level.
|
Yes pal you can do it easily... just convert the image into ByteStream and then using BLOB data type in db you can store it into db.
please check the thread....
Check It
__________________
sanjeev,संजीव
|
|

04-28-2008, 08:46 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
|
|
|
Ah, got it. I remember work with BLOB at my C++ project. Thanks Sanjeev. And also thanks for the link.
|
|

04-28-2008, 08:48 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
|
|
Originally Posted by Eranga
|
|
Ah, got it. I remember work with BLOB at my C++ project. Thanks Sanjeev. And also thanks for the link.
|
It's my pleasure Pal.
__________________
sanjeev,संजीव
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 03:41 PM.
|
|