Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: store bitmap into oracle7 database
Here's a quick little snippet! I just happen to be putting together a skeleton that I'll be using for moving images from a digital camera to an ORACLE Db.
If SQLAllocStmt(hdbc, hStmt) <> SQL_SUCCESS Then MsgBox "start: AllocStmt Failed"
SQLFetchStr = "SELECT max(id) FROM DC50IMAGES" If SQLExecDirect(hStmt, SQLFetchStr, Len(SQLFetchStr)) <> SQL_SUCCESS Then
MsgBox "ExecDirect Failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
MsgBox "SQLFetch failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
MsgBox "GetData failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
If SQLAllocStmt(hdbc, hStmt) <> SQL_SUCCESS Then MsgBox "AllocStmt Failed"
SQLInsert = "INSERT INTO DC50IMAGES (id) VALUES (" SQLInsert = SQLInsert + Str(1) + ")" If SQLExecDirect(hStmt, SQLInsert, Len(SQLInsert)) <> SQL_SUCCESS Then
MsgBox "ExecDirect Failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
If SQLAllocStmt(hdbc, hStmt) <> SQL_SUCCESS Then MsgBox "start: AllocStmt Failed"
SQLUpdate = "UPDATE DC50IMAGES SET IMAGEDATA=? WHERE id=" + Str(1)
lngBufferLength = FileLen("Tester.JPG")
ReDim bytBuffer(lngBufferLength)
Open "Tester.JPG" For Binary As #1
Do While Not EOF(1)
Get #1, , bytBuffer
Loop
Close #1
If SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_LONGVARBINARY, lngBufferLength, 0, bytBuffer(0), lngBufferLength,
lngBufferLength) <> SQL_SUCCESS Then
MsgBox "BindParameter Failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
MsgBox "ExecDirect failed" X = SQLError(henv, hdbc, hStmt, SQLState, NativeErr, ErrMsg, 255, ErrMsgLen) MsgBox ErrMsg
Juan Buiza Camacho <jbuiza_at_net.disbumad.es> wrote in article
<33BAC2FF.37DB_at_net.disbumad.es>...
> I have a bitmap and I need store it into Oracle7 database using API
> ODBC. How I can do it? Any ideas? I've read a little about some classes
> that exchange this information with the database - CLongBinary, I
> think-. Is it right?.
>
> I use Visual C++ 4.0 for Windows 95/NT.
>
> Thanks in advance..
>
> Juan Buiza Camacho
> jbuiza_at_net.disbumad.es
>
Received on Fri Jul 04 1997 - 00:00:00 CDT
![]() |
![]() |