Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: insert BLOB into Oracle DB via ODBC: inconsistent datatypes

Re: insert BLOB into Oracle DB via ODBC: inconsistent datatypes

From: <exilberliner_at_googlemail.com>
Date: Mon, 19 Nov 2007 04:55:47 -0800 (PST)
Message-ID: <14ec02e9-8211-4618-a08b-df2542c45367@b32g2000hsa.googlegroups.com>


Hi Mark,

thanks for your hint on the ODBC version! Somehow I had installed an older ODBC version which seems to have problems with the 10g Server. I simply installed the current 10 XE edition and it worked out of the box!!
So thank you very much again!
Greetings,
chris

On 16 Nov., 20:38, Mark D Powell <Mark.Pow..._at_eds.com> wrote:
> On Nov 16, 11:51 am, "exilberli..._at_googlemail.com"
>
>
>
> <exilberli..._at_googlemail.com> wrote:
> > Hi,
>
> > I am having big troubles when trying to insert an unsigned char array
> > (image thumbnail) into a BLOB field of an Oracle 10g table. Her is
> > what I am doing:
>
> > char* stat = "INSERT INTO TEMP (SHOT_ID,FRAME) VALUES (?,?)";
>
> > rc = SQLPrepare(hstmt, (SQLCHAR*)(const_cast<char*>(stat)), SQL_NTS);
>
> > [...]
>
> > SQLINTEGER type;
> > SQLPOINTER pToken;
> > rc = SQLBindParameter(hstmt , 2, SQL_PARAM_INPUT,
> > SQL_C_BINARY,SQL_LONGVARBINARY,0,0,
> > (SQLPOINTER)2,0,&type);
>
> > type = SQL_LEN_DATA_AT_EXEC(0);
> > rc = SQLExecute(hstmt);
>
> > while (SQL_NEED_DATA == rc) {
> > rc = SQLParamData(hstmt, &pToken);
> > if (rc == SQL_NEED_DATA) {
> > unsigned char* data = .... //fetch image data and store
> > into data array...
> > SQLINTEGER data_size = .... //get size of thumbnail in byte
> > rc = SQLPutData(hstmt, data, data_size);
> > }
> > }
>
> > rc = SQLParamData(hstmt, &pToken);
> > if (rc != SQL_SUCCESS) {
> > //print error string:
> > //SQLGetDiagRec returns "inconsistent datatypes:
> > expected NUMBER got BLOB"
> > }
>
> > I am completely in the dark and have no clue where might be the
> > problem....Any help is very welcome!! Thanks a lot in advance!
> > chris
>
> I cannot comment on the code but whose and what version of an ODBC or
> OLE driver are you using? What tool set is this code written in?
> What version of the Oracle client is installed? What Oracle version
> is the target database?
>
> For example the MSDAORA, MS OLE to Oracle, often used with SQL Server
> 2000 to create linked databases to Oracle does not support the Oracle
> LOB datatype according to a MS document I have. It is too old.
>
> HTH -- Mark D Powell --
Received on Mon Nov 19 2007 - 06:55:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US