Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
SQL Transactions and DBCursors
Francisco_Alcala-Soler_(iaea_001user3_-_(deleted))
Message from via eLinkHi,I have a request handler (RH) that calls three functions among others in thefollowing fashion: Execute Start transaction Function1: Start transaction Update and insert on TABLE End transaction Function2: Create DBCursor on TABLE Function3: Start transaction Update and insert on TABLE End transaction End transactionI have the problem that the DBCursor hangs forever when the outermosttransaction in the Execute method of the RH is used, yet it works perfectwhen this transaction is removed. I wanted to figure out why this ishappening: a) Is it because I am issuing a SELECT cursor on a TABLE where atransaction isn't yet committed? If so, what's the recommended way to placea transaction around the ones in functions 1 and 3? Is my only bet to undowhat's done in function 1 if anything goes wrong later on in the code? b) Is it because I can't nest transactions or because DBCursorsshould not be used within transactions?Thanks for any insight, CurroThis email message is intended only for the use of the named recipient.Information contained in this email message and its attachments may beprivileged, confidential and protected from disclosure. If you are not theintended recipient, please do not read, copy, use or disclose thiscommunication to others. Also please notify the sender by replying to thismessage and then delete it from your system.
Find more posts tagged with
Comments
Brian_Walsh
What is the database version? Which table is it that you are trying to update? When this hangs have you checked the specific locks that are being held? The most likley culprit here is locking in the database. The locks are held by the first transaction and not released therefore the second transaction cannot proceed. There are a number of ways to deal with this. What parameters are you using on the cursor that you open?
Francisco_Alcala-Soler_(iaea_001user3_-_(deleted))
Message from via eLinkHi Brian,> What is the database version? Which table is it that you are > trying to update?It's a table that has nothing to do with the Livelink schema. It's anextension used within a customized module which I am writing.> When this hangs have you checked the > specific locks that are being held?I haven't actually checked this yet. I will fire the Microsoft Profiler andsee what I discover.> The most likley culprit > here is locking in the database. The locks are held by the > first transaction and not released therefore the second > transaction cannot proceed.Can you give any hints as how to figure this out with the Profiler or anyother tool?> There are a number of ways to > deal with this. What parameters are you using on the cursor > that you open? sqlStatement = "select rtrim(cdi.RN) as RN, cdi.CompressedReportNo," + \ "cdi.ID, cdi.Role, cdi.NumRecords, cdi.CDROMNo, " + \ "cdi.LSTLine, cdi.LSTLineSize " + \ "from AR_CDROMIndex cdi " + \ "order by CompressedReportNo, cdi.RN" dbCursor = $LLIApi.DbCursor.New( \ prgCtx.fDbConnect, \ sqlStatement, \ {}, \ SQL.CACHE | 10, \ -1 )For further information, direct CAPI.Exec() SELECT statements on the sametable (AR_CDROMIndex) work well after the transaction in Function1 hasclosed, even though the outer transaction in Execute is still open. Only theDBCursor doesn't work...Thanks for your help, CurroThis email message is intended only for the use of the named recipient.Information contained in this email message and its attachments may beprivileged, confidential and protected from disclosure. If you are not theintended recipient, please do not read, copy, use or disclose thiscommunication to others. Also please notify the sender by replying to thismessage and then delete it from your system.