aspose file tools*
The moose likes Java in General and the fly likes insert and retrieve image from database. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "insert and retrieve image from database." Watch "insert and retrieve image from database." New topic
Author

insert and retrieve image from database.

John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Hi there,
I had an application using jsp to retrieve and store image to oracle. Anyone has any ideea how to start? I know insert syntax insert for oracle but never with the image. I appreciate a lot. Thanks.

John Giang
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Take a look at the PreparedStatement API for blobs and clobs (such as setBlob). If your database columns are set up for binary data, you just need to use one of these methods to set inputstreams (from a file for example) into your update/insert statements.

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html


My Blog: Down Home Country Coding with Scott Selikoff
John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Hi Scott,
I know how to do PrepareState or ordinary Oracle but not the image. I would like to know from Java and Oracle point of views that how to create table to store and retrieve.

John
payal agrawal
Ranch Hand

Joined: Oct 11, 2005
Posts: 44
Look at the URl below:

How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/

In order to insert into Oracle database change the conection string for Oracle. Column type for image is Blob.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insert and retrieve image from database.