dcsimg
jdbc
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   karthik_rajan
Posted On:   Sunday, April 1, 2001 07:03 AM

i want to retrieve a image from database,how to do it in java,if the database is oracle?

Re: jdbc

Posted By:   Christopher_Schultz  
Posted On:   Wednesday, April 4, 2001 09:19 AM

Most databases support a data type which contains an arbitrary amount of binary data (frequently called BLOBs, or Binary Large Objects).



If you're using JDBC v2.0 or greater, you can use the java.sql.Blob interface, and the java.sql.ResultSet.getBlob(...) methods. The Blob interface has a method getBinaryStream() which returns a java.io.InputStream from which you should be able to create an Image.



If you're using a previous version (or you just want to), you can use the java.sql.ResultSet.getBinaryStream(...) methods which return InputStreams also, which can be read. The JDBC API suggests that they be used with LONGVARBINARY column types.



-chris
About | Sitemap | Contact