The information in this article applies to:
SUMMARYThis article discusses when multiple active statement handles are allowed on an ODBC connection handle with Microsoft SQL Server 6.0 or later. You can find additional information on this topic in the chapter on the Microsoft SQL Server driver in the book "Inside ODBC" by Kyle Geiger, published by Microsoft Press. MORE INFORMATION
This information applies to Microsoft SQL Server ODBC Drivers version
2.50.0121 or later when running against Microsoft SQL Server version 6.0 or
later. Earlier versions of the Microsoft driver or Microsoft SQL Server do
not support multiple active statements on a connection handle. If you are
using third party SQL Server ODBC drivers, you should review the
documentation accompanying the driver to see if it supports multiple active
statements with SQL Server 6.0.
When the SQLExecDirect() on hstmt1 is executed, the Microsoft SQL Server ODBC driver will issue a cursor open request. When SQL Server completes the cursor open, it considers the command to be finished and will allow the application to then issue a command on another hstmt:
Once again, after the server has finished with the cursor open request issued by the client, it considers the statement to be completed. If at this point the ODBC application does:
the ODBC driver will send to SQL Server a cursor fetch for the first five rows of the result set. Once the server has transferred the five rows to the driver, it considers the fetch processing completed and will accept new requests. The application could then do a fetch on the cursor opened for the other statement handle:
SQL Server will accept this second command on the connection handle because, as far as it is concerned, it has completed the last command on the connection handle, which was the fetch of the first five rows of the rows for hstmt1. This process only works when the ODBC driver uses server cursors. As documented in the Microsoft SQL Server ODBC Driver documentation, the driver uses server cursors except when the following statement options are set:
The ODBC driver does use server-side cursors for all other options when executing a single SELECT statement, or a stored procedure that contains only a single SELECT statement. The current implementation of server cursors in SQL Server 6.0 itself does not support batches of SQL statements or stored procedures that have more than one SELECT statement. Additional query words: sql6 odbc concurrent
Keywords : kbenv kbinterop kbusage ODBC SSrvProg SSrvStProc |
Last Reviewed: March 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |