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

Re: Writting long data to an Oracle database using odbc

From: Isabelle Fernandez <isabelle_at_focus-fr.com>
Date: Wed, 22 Jul 1998 12:11:39 +0200
Message-ID: <35B5BADB.16BBBB80@focus-fr.com>


Hello !

I have exactly the same problem. I have written some code with Visual C++ 5.0 and ODBC sdk 3.0 to write long raw to the database. I was previously using Oracle 8.03 server version and everything was perfect. I was using Oracle in a NT server and accessing it through the network. I had installed client side on my own computer (ODBC driver 8.03 and SQL Net)

Yesterday I erased everything on my computer and installed the Personal Oracle 8.04 with ODBC driver and all the stuff. Since that, the SQLPutData function works well for the first written buffer but fails on the second call.... The answer is : "Bad buffer piece" but my pointer is not null and the buffer contains a lot of data (65535 bytes precisely).

I have seen in the release notes that some changes have been made on the SQLPutData function but cannot find out what the problem is exactely...

Can anyone help ??

Thanks
Regards
Isabelle.

Neophytos Michael wrote:

> 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

--

* Isabelle Fernandez
* Product Division, Database administrator
* FOCUS Imaging, Les Genets, 449 Route des Cretes, 06560 Valbonne Sophia
Antipolis, France
* Tel: +33 (0)4 92 38 88 10, Fax: +33 (0)4 92 38 96 46, Mailto:isabelle_at_focus-fr.com Received on Wed Jul 22 1998 - 05:11:39 CDT

Original text of this message

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