-
Hi all,
I have to insert a jpg image in a blob field.
The structure of table test is
co number(02),
im blob
I performed this command and it´s ok
insert into test values(1, empt_blob());
But I don´t know how can I perform insert a jpg image.
Please, give me a example.
Anyone can help me?
Valentin
Valentin
-
hi,
There is an object type called ORDSYS.ORDImage in intermedia. So using that, u create a table and first insert empty row into the table.
Lock that particular row before updating the empty column using select...for update
use the getContent method to get the LOB locator.
populate the data with dbms lob calls or write an OCI program to fill in the image BLOB.
with regards
Prasanna S
-
There are two different ways that you can store such things. One is to store the entire content in oracle and retrive them when needed. Other is storing the contents as a file in the server and then using bfile( if I remember correct) you can give a pointer to the file. Then you can use oracle to retrive it.
The second option would be easier to maintain and you can have an idea on the growth. The first it is harder to have a control, b'cos jpegs would come in different sizes.
make a vicee choice,
Sam
Thanx
Sam
Life is a journey, not a destination!
-
I loaded jpegs in Oracle from Visual Basic. I remember I open the file binary and get chunks of data and insert it in Oracle I attached the VB code, hope it helps:
Public Sub AddPhoto(DP As Integer, filename As String)
Dim i As Integer
On Error GoTo error
rdoEnvironments(0).CursorDriver = rdUseOdbc
connectstring2 = "DSN=hold;UID=vmcs;PWD=vmcs;"
Set databaseCn2 = rdoEnvironments(0).OpenConnection("hold", rdDriverNoPrompt, False, connectstring2)
Set Qd = databaseCn2.CreateQuery("Photo", "select * from " & DBS_PREFIX & "driver_pictures where driver_permit = " & DP)
Set rdoRes = Qd.OpenResultset(rdOpenKeyset, rdConcurRowVer)
If rdoRes Is Nothing Or rdoRes.Updatable = False Then
' MsgBox "Can't open or write resultset"
Exit Sub
End If
If rdoRes.EOF Then
rdoRes.AddNew
rdoRes!driver_permit = DP
Else
rdoRes.Edit
End If
Open filename For Binary Access Read As 1
FL = LOF(1)
If FL = 0 Then End
Chunks = FL \ chunksize
Fragment = FL Mod chunksize
If rdoRes!Picture.ChunkRequired = True Then
rdoRes!Picture.AppendChunk Null
ReDim Chunk(Fragment)
Get 1, , Chunk()
rdoRes!Picture = Chunk()
ReDim Chunk(chunksize)
For i = 1 To Chunks
Get 1, , Chunk()
rdoRes!Picture.AppendChunk Chunk()
Next i
Close 1
Else
ReDim Chunk(FL)
Get 1, , Chunk()
rdoRes!Picture = Chunk()
End If
rdoRes.Update
rdoRes.Close
Exit Sub
error:
-
blob
prazy, sambavan, mara
thanks a lot.
Valentin
Valentin
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
|