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 -> Writting long data to an Oracle database using odbc

Writting long data to an Oracle database using odbc

From: Neophytos Michael <nmichael_at_hynet.com>
Date: Mon, 06 Jul 1998 17:54:01 +0100
Message-ID: <35A10129.C51E78A0@hynet.com>


Oracle version: Oracle 8.04
Odbc Driver: Oracle ODBC driver 8.04
IDE: Visual C++ 5.0

I am trying to insert a row into a table using odbc. One of the table columns happens to be a long column. I have followed the examples in the Microsoft odbc sdk to the letter but I haven't been successful yet. I would appreciate any help anyone can offer, especially sample code. Here is what I do:

rc = SQLAllocStmt(hdbc, &hstmt);
rc = SQLPrepare(hstmt, mruStoreQuery, SQL_NTS); if (rc == SQL_SUCCESS) {

   longInd = SQL_DATA_AT_EXEC;

   rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &m_coreId, 0, &ui);

   rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &m_mruType, 0, &ui);

   rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &m_fileId, 0, &ui);

   rc = SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_SLONG,
SQL_INTEGER, 0, 0, &m_fileVersion, 0, &ui);
   rc = SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_LONGVARBINARY, 0, 0, (SQLPOINTER)5, 0, &longInd);

   rc = SQLExecute(hstmt);
   res = (rc == SQL_NEED_DATA);
   if (res) {
    rc = SQLParamData(hstmt, &tmp);
    res = (rc == SQL_NEED_DATA);
   }
  }

Up to this point everything succeeds.

After this I make the SQLPutData calls and when this is done I call SQLParamData again to tell odbc that we are done with this long. This calls always fails and so the entire insert stament fails. I have also tried setting the indicator to the result of SQL_LEN_DATA_AT_EXEC(0); but the same thing happens.

Any help would be gratelly appreiciated. If this is not the write newsgroup for these kinds of questions please point to another group.

Thank you,
Neophytos Received on Mon Jul 06 1998 - 11:54:01 CDT

Original text of this message

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