|
-
Mar 22nd, 2002, 11:12 AM
#1
Thread Starter
Addicted Member
Resolved: Image in Oracle?
Can images be stored in Oracle? I am using ImageLibrary_tutor of Beacon with the database is Oracle. Someone told me that image might be stored in Oracle as bfile (binary file lob) but when I try to add the image into the table I got :
OIP-04125: Invalid file type. Does anyone know what is it and how to fix? I don't have Oracle Documentation installed to look it up.
Thanks alot.
-vb
Last edited by vbvbvbvb; Mar 26th, 2002 at 01:45 PM.
-
Mar 22nd, 2002, 01:03 PM
#2
Fanatic Member
If you are using version of Oracel less than 8i, use datatype Long Raw. 8i and above, use BLOB
-
Mar 22nd, 2002, 02:56 PM
#3
Thread Starter
Addicted Member
Thanks.
I'm using O040 to connect to Oracle 8.1.6
VB Code:
Private Session As Object 'OracleInProcServer.OraSession
Private Database As Object 'OracleInProcServer.OraDatabase
Private rs As Object 'OracleInProcServer.OraDynaset
Private Const ORADB_NOWAIT = &H2& 'same as ORADB_NOWAIT = 2
Private Const ORADYN_DEFAULT = &H0&
Private Sub Form_Load()
Dim strSQL As String
Set Database = Nothing
Set Session = CreateObject("OracleInProcServer.XOraSession")
Set Database = Session.OpenDatabase(DatabaseName, "user/pass", ORADB_NOWAIT)
Set rs = Nothing
strSQL = "SELECT * FROM Image"
Set rs = Database.CreateDynaset(strSQL, ORADYN_DEFAULT)
FillFields .
End Sub
Everything seems OK until after an image is added:
Public Sub FillFields()
If Not (rs.BOF And rs.EOF) Then
txtDescription.Text = rs.Fields("Description")
Set Image1.DataSource = rs 'setting image1's datasource->
->run time error '13' type mismatch
'I tried both Long Raw & BLOB and got same error
Image1.DataField = "Picture" 'set its datafield.
End If
Everything becomes harder to handle when it related to Oracle...
Last edited by vbvbvbvb; Mar 22nd, 2002 at 03:13 PM.
-
Mar 25th, 2002, 10:07 AM
#4
Thread Starter
Addicted Member
Any one ever tried Beacon's tutor using Oracle instead of Access?
-
Mar 25th, 2002, 07:18 PM
#5
PowerPoster
Not that i know of!!
Sorry i dont have oracle but this link may help:
tektips
good luck
b
-
Mar 26th, 2002, 11:29 AM
#6
Thread Starter
Addicted Member
Thanks for your response. I found a couple site talking about image & oracle but they didn't point Image.DataSource to rs. Instead they load the picture
Image.LoadPicture = Dialog.Filename
When the form is loaded, image is not displayed until they select a pic from the dialog. That's not what I want. I want to load pic from Oracle database.
I can add new pic and see that they are in my table but just cannot retrieve them.
Thanks anyways.
-vb
-
Mar 26th, 2002, 01:49 PM
#7
Thread Starter
Addicted Member
If you want to use Beacon's code and Oracle database, here it is:
VB Code:
'Picture is Long Raw
Private cn As ADODB.Connection
Private rs As ADODB.Recordset
Dim strConn As String
Private Sub Form_Load()
Dim strSQL
Set cn = New ADODB.Connection
strConn = "UID=user;PWD=password;" & _
"driver={Microsoft ODBC for Oracle};" & _
"SERVER=server;"
cn.Open strConn
strSQL = "Select PicId, Description, Picture from Image"
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open strSQL, cn
FillFields
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|