Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: DIRECTORIES and BFILE problems

Re: DIRECTORIES and BFILE problems

From: D Rolfe <dwrolfeFRUITBAT_at_orindasoft.com>
Date: Thu, 03 Mar 2005 10:38:14 +0000
Message-ID: <rOBVd.48733$Z14.36488@news.indigo.ie>

JavaDeveloper wrote:
>
>
> INSERT INTO MYTABLE (BFILE_COLUMN)
> VALUES ( bfilename ('TEMP_DIR', 'binaryfile.dat'))
>

This command does *not* load the Bfile into the database. Intstead it tells Oracle that there is a file called 'binaryfile.dat' in the directory 'TEMP_DIR' on the same computer that is running the Oracle server software.

> After these steps, controlling the table with a graphical DB tool (i.e.
> Toad), I see that in the BFILE column, after the name of the file loaded,
> there is a notice like "NoExist".
> Reading that BFILE in my Java program, I find out that the file length is 73
> bytes instead of 40 Kb!!!
> The file does not exist!!!
> My question is... why???
>

The 73 bytes is how much space Oracle takes to store the name of the directory and the name of the file. BFILE's arent stored *in* the database. If you want to do that and aren't on the database server machine use BLOB or CLOB.

> Note: Le DB is not in my computer, but the file binaryfile.dat is my local
> file system. Maybe, the loading works only on the same file system of the
> DB?? I hope not! :-)
>
> Thanks
>
> Matt
>

You can do one of the following things:

  1. Use BLOB or CLOB to store the file.
  2. Use BFILE to access (not store!) the file by 2(a) Running your program on the same machine as the database server. or 2(b) Creating the BFILE pointers and then using some other process to copy the file to the DB server before anyone notices it's not really there.

David Rolfe
Orinda Software
Dublin, Ireland

Makers of OrindaBuild, which writes Java to run PL/SQL procedures. Received on Thu Mar 03 2005 - 04:38:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US