Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Inserting the binary data into the oracle database
Hi,
I'm a newbie to oracle. I'm trying to insert the binary data using the c interface OCI.
The field i am inserting in database table is of type RAW(16).
int main(int argc, char* argv[])
{
String uuidStr = _T("33958A21AAEF3378890201F695868FF9") ;
/* some how we are converting the uuidStr to 16bytes hex value and put into buf as binary */
text *insert_sql=(text *)"insert into table(uuid) values (: 1)";
if(OCIStmtPrepare(stmthp, errhp, insert_sql, strlen((char*)insert_sql), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT))
{
printf("Error\n"); } /* binding the position with the buffer containing the binary data */ if (OCIBindByPos(stmthp, &bindnps[0], errhp, 1, (dvoid *)buf, (sb4)buflen, SQLT_BIN, (dvoid *)&indps[0], (ub2 *) 0,
(ub2 *) &rcodes[0],0,0, OCI_DEFAULT))
{
printf("Error\n"); } if(OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1,(ub4)
0, (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_STMT_SCROLLABLE_READONLY ))NULL, &errcode,
{
my_printerror(errhp);/* text msgbuf[1024]=""; int errcode=0; OCIErrorGet((dvoid *) errhp, (ub4) 1, (text *)
msgbuf, (ub4) sizeof(msgbuf), (ub4)OCI_HTYPE_ERROR);
printf("%s in the line %d\n",msgbuf,__LINE__); } }
the statement execution fails with the error "End of file in communication channel"
With this i am not able to insert the binary data, Is some thing wrong with the code.
Or can some one suggest how could able to insert binary data into oracle database.
Many thanks in advance
~PR Chary
Received on Fri Mar 02 2007 - 09:18:31 CST
![]() |
![]() |