From: Neophytos Michael <nmichael@hynet.com>
Subject: Writting long data to an Oracle database using odbc
Date: 1998/07/07
Message-ID: <35A24BB3.B39B1CF6@hynet.com>#1/1
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsabuse@supernews.com
X-Trace: 899858229 PJ0EG9MGB3DF CDB2C usenet52.supernews.com
Organization: The World's Usenet -- http://www.Supernews.com
Mime-Version: 1.0
Newsgroups: microsoft.public.odbc,microsoft.public.odbc.sdk,microsoft.public.odbc.beta.oracle,comp.databases.oracle.tools


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




