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

How to insert images in Oracle

Jagmohan Negi
Greenhorn

Joined: Aug 24, 2005
Posts: 27
How to insert images in Oracle through Java?plz let me know by an example in Java
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It better to store images on the file system, and only store the path describing their location in the database. However, if you absolutely must store images in the database, you need to use a BLOB or CLOB datatype in your table and used the setBlob() method of a PreparedStatement.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30965
    
158

More specifically a BLOB since an image is binary data, not character data.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by Jeanne Boyarsky:
More specifically a BLOB since an image is binary data, not character data.

Woops. Posting with my brain only half turned on. Listen to Jeanne, Jagmohan Negi. She's paying more attention than I am.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30965
    
158

Thanks Paul

Jagmohan,
As an example, take a look at jGuru's tutorial.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Particularly for Oracle:
http://www.stanford.edu/dept/itss/docs/oracle/9i/java.920/a96654/oralob.htm#1043220

See also:
http://www.coderanch.com/t/301629/JDBC/java/creating-inserting-Blob
Jagmohan Negi
Greenhorn

Joined: Aug 24, 2005
Posts: 27
Thanx to all of u,Now i have done it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to insert images in Oracle