hello everyone...
could anyone tell me how to store images in oracle database..or which datatype has to use for it..

Recommended Answers

All 14 Replies

Convert the image into a binary stream and store in a BLOB field in oracle.

Moved to Oracle forum.

Member Avatar for hfx642

Personnally, I prefer to leave images on the network file server, than to store them in the database.
However, being a consultant, I pretty well have to do what my clients want.

commented: agree +13

Is it really necessary to store the images in the database? Like debasisdas pointed out, you can store the image as binary.
Maybe it's a good idea to store the images on the server and just make a reference to it's directory on the database.

Use BLOB datatype to store image in database

Storing images themselves in a database sounds like a really bad idea, just store the server path.

You are absolutely right JBENNET, but i just answered the question asked..........

thanks a lot, but can u please tel hw to store server path in the database..
means is there any technique to convert?

What?

Just store it as text!

I.e. upload the images themselves to your (web/ftp/whatever) server, then just store the path to them in the database.

e.g. the datatabase would hold something like "http://fileserver.mydomain/images/img1.jpg"

No need to convert anything.

1. Create a directory in the server.
2. Create an Oracle directory for the server directory.
3. Store all the files in the server directory.
4. In the database store the file path as string and also the Oracle directory name.

Member Avatar for hfx642

Technically, you don't have to store anything in the DB.
Put all of you images in one location on the network.
eg. /Production/My_System/Images
Name your image file with the record PK.
eg. 0123456.jpg
If there is ever a breach in security,
people's names are NOT show with the image.

hello everyone...
could anyone tell me how to store images in oracle database..or which datatype has to use for it..

Hi you can store images in oracle by using datatype as Bfile. it has a capacity of 4 gb of filesize. Bfile stores Binary data of external file upto 4 gb.

Hope this helps.

Using bfile is same as storing the path of the file in disc.

In this approach the problem is if the file is deleted or moved out of the specified oracle directory oracle will will be unable to retrieve the file and will throw an error.

k... then how to Convert the image into a binary stream .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.