Can you get a filehandle to an Oracle SecureFile LOB? Does Oracle's SecureFile LOB allow me to obtain a filehandle to the underlying resource.

Both PostgreSQL through lo_open and SQL Server with FILESTREAM's OpenSqlFilestream allow you to get a native filehandle to a resource tracked by the database. What's the Oracle alternative to this?


With PostgreSQL you get a filehandle by providing a resource id (large object id) that is only valid for the duration of the transaction and the DB provides the filehandle.
With SQL Server you get a transactionToken which is only valid for the duration of the transaction which you can provide to the OpenSqlFilestream to get a filehandle.
No, to SecureFile's exposing a FileHandle

You can not. There is no filehandle to (internal) LOBs. Oracle separates their large binary implementations into ones that are internal, or external. Internal Lobs are tracked with a "Lob Locator" (Oracle terminology) which is of type OCILobLocator in the OCI. You can perform operations on them with the Oracle Call Interface (OCI). The OCI's operations take a Lob Locator as a handle but are not otherwise useful, and do not have an equivalent for all POSIX operations. For example, there is no fseek.


OCI Lob Interface (C)
OCCI Programming with Lobs (C++)


External LOBs

Oracle Provides an "external LOB" called a "BFILE". The BFILE is associated with a path on disk. Using that path, you can manually open the file with open, but there is no transaction token, and the filehandle is not closed at the end of the transaction. Note "BFILE"s do not support deduplication, compression, or encryption and you'll be left to the underlying filesystem of the disk for those faculties.