Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    9

    Angry Unanswered: ODBC inserting against open cursor

    Im receiving 'HY000 Connection is busy with results for another hstmt' when trying to insert. The reason is down to another hstmt with a cursor still open (as not all results have been fetched) against the same connection handle. My current design is one connect handle per file, with multiple statement handle depending on sql issued so i dont need to rebind.
    I'm guessing, but is there a sqlsetconnectattr/sqlsetstmtattr setting to which will allow me to insert/update/delete to a file with a open cursor that may include the result ???

    sqlserver version 8

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    So more like you've locked the rows...

    Look at sp_lock....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jan 2004
    Posts
    9
    doesnt seem like a locking issue, as cant insert. sp_lock shows one new process with a lock mode S (presume shared, to which insert should be ok)

    my sql generated ..

    DECLARE KSQL$001_00 CURSOR FOR SELECT ROWID,KEY_1A,KEY_5A,KEY_NUM
    BER,SOMETHING FROM A2R.DBO.CJS ORDER BY KEY_5A,KEY_NUMBER,KEY_1A

    OPEN KSQL$001_00

    FETCH KSQL$001_00

    INSERT INTO A2R.DBO.CJS(KEY_1A,KEY_5A,KEY_NUMBER,SOMETHING) VALUES (?,?,?,?)

    [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another h
    stmt
    ****************************
    HY000

    The above is fine via SQLQuery (note: ? are sqlbindparameter), but not ODBC???

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    In RDO it used to be rdOpenForwardOnly resultset qualifier that would allow you to issue action queries on the same connection while the resultset mentioned above is open.

  5. #5
    Join Date
    Jan 2004
    Posts
    9

    Talking Solved!

    Cheers for pointing me in the right direction,
    I needed to issue the following, which now allows insert etc with open cursors.

    SQLSetStmtAttr(vsql_area.current_logon->stmt_current>hstmt,
    SQL_ATTR_CURSOR_SENSITIVITY,
    SQL_INSENSITIVE,
    1);

    Regards,
    Carl.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •