Writting long data to an Oracle database using odbc

From: Neophytos Michael <nmichael_at_hynet.com>
Date: 1998/07/07
Message-ID: <35A24BB3.B39B1CF6_at_hynet.com>#1/1


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 Tue Jul 07 1998 - 00:00:00 CEST

Original text of this message