There are a couple of bugs in SQL Server whereby Locks applied by Cursors are not dropped when the Cursor is closed - does anyone know of a way round this other than dropping the connection?
You can try to use the CLOSE CURSOR statement that includes the WITH RELEASE clause, if supported. Do not use WITH RELEASE when operating under RS or RR isolation levels.
Thanks for your input - have tried this one but unfortunately I do actually need the RR Isolation Level in the application for other reasons.
(I should have noted this down originally) I have tried most things like various (applicable) isolation levels, different cursor definitions and currently have a call outstanding with Microsoft.
Things are a little bit more complicated than this. In a normal SQL structured environment - you normally do have 'controlled' transactions. This application is an extreme legacy C-ISAM product and in effect we are replacing C-ISAM reads/inserts/updates/deletes with calls to libraries which actually perform the SQL statements. This means that we have open ended transactions that are never committed or rolled back... (its really bad design but needs must)
This is why we have multiple cursors open on the connection (and why I cannot drop the connection and why I need RR isolation levels) I also cannot set implicit transactions because this returns errors in our COBOL - the cursors do not finish opening at the point we try to fetch from the cursor.
This is possibly because the Select in SQL (in order to mimic ISAM) is a >= key which is open ended and can return 1000's of rows (I appreciate that this is also a problem in its own right for SQL and Server performance - but we are 'ignoring' this for the moment).
The bugs are logged on MICROSOFT Knowledge base article nos 201905/273879
I do not really think there is a real solution to this one - except to ignore record locking for the time being
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.