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

Home -> Community -> Usenet -> c.d.o.misc -> BLOB ODBC Oracle

BLOB ODBC Oracle

From: <sabys_at_my-dejanews.com>
Date: Tue, 08 Dec 1998 16:07:03 GMT
Message-ID: <74jir5$v5$1@nnrp1.dejanews.com>


Hi!

We are running into a problem while inserting LOBS through the Oracle ODBC driver. We are using Oracle 8.0.4 RDBMS and 8.0.5 Oracle ODBC driver.

For some reason, it is not working and it fails in SQLPutData and SQLParamData. Could you please throw some light?

Here is the code that we wrote:

void COdbcTestView::OnProceduresOther() {

   char           CmdBuff[128];
   char           BlobData[128];
   SQLINTEGER     BlobSizeIndicator;
   SQLPOINTER     ParameterPtr;
   SQLRETURN      l_ret,ret;

   strcpy(BlobData,"ABCDEFGHIJKL");

   BlobSizeIndicator = SQL_LEN_DATA_AT_EXEC(strlen(CharData));

   sprintf(CmdBuff,"insert into test_odbc (c_blob) values(?)");

   l_ret = SQLPrepare(m_ptr_dbproc->hStmt,(unsigned char *)CmdBuff,SQL_NTS);

   l_ret = SQLBindParameter(m_ptr_dbproc->hStmt,

                           1,
                           SQL_PARAM_INPUT,
                           SQL_C_BINARY,
                           SQL_LONGVARBINARY,
                           0,
                           0,
                           (SQLPOINTER)BlobData,
                           0,
                           &BlobSizeIndicator);

   l_ret = SQLExecute(m_ptr_dbproc->hStmt);

   while (l_ret == SQL_NEED_DATA)
   {

      l_ret = SQLParamData(m_ptr_dbproc->hStmt,&ParameterPtr);
      if (l_ret == SQL_NEED_DATA)
      {
         ret = SQLPutData(m_ptr_dbproc->hStmt,ParameterPtr,strlen((char *)
ParameterPtr));
      }

   }

   return;
}

//
// Table Generation script
//
/*

CREATE TABLE test_odbc
(
	c_char		CHAR(1),
	c_tiny		NUMBER(3),
	c_smallint	NUMBER(5),
	c_int		NUMBER,
	c_double	NUMBER,
	c_float		NUMBER,
	c_date		DATE,
	c_datetime	DATE,
	c_string	CHAR(31),
	c_varchar	VARCHAR2(31),
	c_datestr	DATE,
	c_datetimestr	DATE,
	c_blob		blob

);
*/

Thanks a lot for your attention.

regards,

saby

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Dec 08 1998 - 10:07:03 CST

Original text of this message

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