Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2008, 09:11 AM
Member
 
Join Date: Apr 2008
Posts: 16
Rep Power: 0
thamizhisai is on a distinguished road
Default java to mysql
Can anyone please give me a sample how to insert image to MySQL and retreiving it.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 04-27-2008, 07:26 AM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 540
Rep Power: 3
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Default
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-27-2008, 04:00 PM
Member
 
Join Date: Aug 2007
Posts: 20
Rep Power: 0
Rgfirefly24 is on a distinguished road
Default
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");
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-27-2008, 06:18 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 540
Rep Power: 3
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Default
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
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-28-2008, 06:28 AM
Member
 
Join Date: Aug 2007
Posts: 20
Rep Power: 0
Rgfirefly24 is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-28-2008, 06:44 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
In simple word convert the image into binaries and store it in a database as a image(image data type)
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-28-2008, 06:46 AM
Member
 
Join Date: Aug 2007
Posts: 20
Rep Power: 0
Rgfirefly24 is on a distinguished road
Default
hrm interesting. Didn't know that there was an image data type.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-28-2008, 07:55 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by Rgfirefly24 View Post
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.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 04-28-2008, 08:15 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
sanjeevtarar is on a distinguished road
Default
You can store images into DB by converting images into byte streams.
__________________
sanjeev,संजीव
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 04-28-2008, 08:33 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Originally Posted by sanjeevtarar View Post
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.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 04-28-2008, 08:41 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
sanjeevtarar is on a distinguished road
Default
Originally Posted by Eranga View Post
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,संजीव
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 04-28-2008, 08:46 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,449
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Ah, got it. I remember work with BLOB at my C++ project. Thanks Sanjeev. And also thanks for the link.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 04-28-2008, 08:48 AM
sanjeevtarar's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 254
Rep Power: 2
sanjeevtarar is on a distinguished road
Default
Originally Posted by Eranga View Post
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,संजीव
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
java to mysql thamizhisai Advanced Java 1 04-26-2008 09:21 AM
mySQL HELP!!! ace84 New To Java 0 04-19-2008 11:39 PM
Java program that transfers stock prices to MySQL database naipulb New To Java 2 04-17-2008 06:02 PM
MySQL 5.0 data backup from java sanjay_sharma77 Database 1 11-06-2007 01:19 PM
Mysql Help Sumendra Maharjan Database 1 08-08-2007 02:19 AM


All times are GMT +2. The time now is 03:41 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org