Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store tiff files in tables? 1

Status
Not open for further replies.

Jeronimo

Programmer
Aug 2, 2001
12
US
Hi,

I have some image files (tiff) which I would like to store in tables. Is this possible? If so, how?

Thanks,
Jeron
 
Jeron,

You can store any type of data in a long column.. [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Let me refine the problem:
I want to retrieve image files from my local hard drive in tables. I have the following PL/SQL code:

DECLARE
Lob_loc BFILE := BFILENAME('C:\', 'picture.tif');
BEGIN
/* Open the BFILE: */
DBMS_LOB.FILEOPEN (Lob_loc, DBMS_LOB.FILE_READONLY);
/* ...Here the file will be inserted in the table...hopefully. */
DBMS_LOB.FILECLOSE(Lob_loc);
END;
/

The path and the filename are correct. However, I get the following error:
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at &quot;SYS.DBMS_LOB&quot;, line 475
ORA-06512: at line 1
 
Ok.... (I don't know much about forms....)

Is DBMS_LOB.FILEOPEN trying to open a server-side file? [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
I almost forgot -- there's an Oracle Forms forum on Tek-Tips that you might find useful, I don't know how active it is (you're welcome here as well of course <grin>) [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Hi Mike,

thanks for your reply. Yes, DBMS_LOB.FILEOPEN opens a serverside file. I've found out why the code does not work: 'C:\' is not correct. I have to create a directory object, e.g. CREATE DIRECTORY &quot;image_dir&quot; AS 'C:\images\'; then, instead of 'C:\', I have to use 'image_dir'. But I still don't know how to store the thing in a table....

Jeronimo
 
Hi, Jeronimo

The following line of code works for us in a forms45 trigger:-

read_image_file('c:\quickcam\latest.tif','TIFF', 'photo_photo');
^^ ^^ ^^
file name image type column name

photo_photo is the database field/column name in the form that you want to load the image into. Committing then stores the photo in the appropriate row of the table.
The photo_photo column is LONG RAW.

We use Connectix Quickcam camera and software to store the photos, always under the same file name, 'latest.tif', and immediately load it into the Oracle form and store it before taking the next photograph.

Cheers,

RogerD
You can similarly use the following to write a file out from the database:-

write_image_file('c:\quickcam\latest.tif','TIFF', 'photo_photo');

See page 17-2 of the Oracle Developer's Guide Manual for Forms 4.5, or equivalent late manuals.

Hope this helps.
 
Roger,

This should be a FAQ.... I'd vote you for TipMaster as well, but the link is missing at the moment.... <frown> [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top