PRB: ODBC SQL Server Driver and Access Violation on SQL ServerLast reviewed: September 9, 1996Article ID: Q114630 |
The information in this article applies to:
SYMPTOMSWhen using the SQL Server ODBC driver with an ODBC enabled application to access SQL Server for Windows NT, an update on a table with a trigger which calls a stored procedure, which in turn contains an unmatched COMMIT TRAN or ROLLBACK TRAN statement, may cause an access violation to be encountered on SQL Server, causing SQL server to terminate. In case of Access and Visual Basic, an attempt to update the SQL server table, will generate the following message,
ODBC - Update failed.followed by:
[Microsoft][ODBC SQL Server Driver]Communication Link Failure.For ODBC application writer, the following steps will encounter the behavior:
// prepared execution to update the table SQLPrepare: update <tablename> set <col>= ? where <col>=? //Set parameters for the above prepared stmt SQLSetParam: //Begin transaction SQLSetConnectOption: fOption: SQL_AUTOCOMMIT vParam : FALSE or 0 //Execute the previously prepared stmt SQLExecute:This will return SQL_ERROR, with szSqlState = "08S01", *pfNativeError = 0, *pcbErrorMsg = 61, szErrorMsg = [Microsoft][ODBC SQL Server Driver] Communication link failure.
WORKAROUNDThis does not happen, if on SQL Server, the ROLLBACK TRAN or COMMIT TRAN statement itself is contained in the trigger instead of being in the stored procedure that is called by the trigger. This happens only for prepared execution in ODBC. Thus, another workaround is to revoke stored procedure permissions from the users which will result in a non-prepared execution, and it will not cause access violation on the SQL Server.
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |