Access Oracle and Blob files in VB
Posted on 2004-08-31
I have an Oracle table:
CREATE TABLE MYOBJECT(
OBJECTID NUMBER (9) NOT NULL,
OBJECT BLOB NOT NULL);
It contains the OBJECTID and an OBJECT. In my case the OBJECT field is populated by TIFF files (most over 1 megabyte in size).
I wanted a little VB interface to query and display this TIFF. I did not want to do this via an Oracle Forms. There are several reasons but I am not going to get into it.
I am able to make an oracle connection:
Public Function connectoracle() As Boolean
On Error GoTo error5
logoninfo = "scott/tiger"
'Connect to the Database
'Create a reference to the OO4O dll
Set objSession = CreateObject("OracleInProcServer.XOraSession")
'Create a reference to my database
Set objDataBase = objSession.OpenDatabase("MYDB", logoninfo, 0&)
'The select statement
SQLStr0 = "SELECT OBJECTID, OBJECT FROM MYOBJECT"
'Run Queries and Create DynaSets
Set OraDS0 = objDataBase.DbCreateDynaset(SQLStr0, 0&)
oraval1 = OraDS0.Fields(0).Value
oraval2 = OraDS0.Fields(1).Value '<-- This would hold the Tiff.
Screen.MousePointer = vbDefault
X = MsgBox("Error logging in to Oracle", vbOKOnly, "Error")
The issue is that I can not seem to return the BLOB field. I wanted to get the OBJECT in and then display it into image box or picture box (not sure which works yet).
My first goal is to be able to fetch the BLOB and then display it on the FORM.
Another goal would be for me to specify a single OBJECTID or range of OBJECTIDs and then have those BLOB object printed out (on the default printer) (scaled to print to the page size only if larger than the page, and print out mulitiple pages if it is a mulitple page TIFF).
Has anyone done this via VB?
Does Anyone know how to fetch an Oracle BLOB field?
Does anyone know how to display an Oracle BLOB field?
Does anyone know how to print out an Oracle BLOB field?