Locking behaviour against SQLServer
Locking behaviour against SQLServer
Hi guys,
we want to offer our customers to use additionally MS SQLServer as database system.
I struggle with the locking behaviour from master - detail tables. As we use often 2 or more sql handles in a loop, we have to set enablemultipleconnections=1. But then I can't update both a master and a detail table in one transaction.
If I set autocommit to TRUE, it works, but this doesn't make sense to me because I want commit the transaction after the updating from all involved tables in the transaction.
It seems that SQLServer locks also the entries in the detail-table from the updated foreign key.
Testcase, SQL-Script and sql.ini in attachment.
Any hints?
Ewald
we want to offer our customers to use additionally MS SQLServer as database system.
I struggle with the locking behaviour from master - detail tables. As we use often 2 or more sql handles in a loop, we have to set enablemultipleconnections=1. But then I can't update both a master and a detail table in one transaction.
If I set autocommit to TRUE, it works, but this doesn't make sense to me because I want commit the transaction after the updating from all involved tables in the transaction.
It seems that SQLServer locks also the entries in the detail-table from the updated foreign key.
Testcase, SQL-Script and sql.ini in attachment.
Any hints?
Ewald
You do not have the required permissions to view the files attached to this post.
Re: Locking behaviour against SQLServer
We use Sqlserver ODBC and not the Native Client which has these problems.
Re: Locking behaviour against SQLServer
how do you connect cursors? do you use sqlsetparameter?
Re: Locking behaviour against SQLServer
Use OLEDB instead of ODBC. There are no such issues with OLEDB and it works faster.
Thanks to Steve Leighton who provided me an OLEDB sample.
Samad
Thanks to Steve Leighton who provided me an OLEDB sample.
Samad
Re: Locking behaviour against SQLServer
Sry, dont understand what you're mentioned. With TD against SQLServer I can't use the native client or am I wrong?
Like in the sample described:
!!CB!! 129
Set lv_bOk = SqlConnect( lv_hSql1 )
Call SqlSetIsolationLevel( lv_hSql1, 'RL' )
Call SqlSetIsolationLevel( lv_hSql2, 'RL' )
!
Call SqlSetParameter( lv_hSql1, DBP_PRESERVE, TRUE, '' )
Call SqlSetParameter( lv_hSql2, DBP_PRESERVE, TRUE, '' )
!
Call SqlSetParameter( lv_hSql1, DBP_ROLLBACKONTIMEOUT, TRUE, '' )
Call SqlSetParameter( lv_hSql2, DBP_ROLLBACKONTIMEOUT, TRUE, '' )
!
Call SqlSetParameter( lv_hSql1, DBP_AUTOCOMMIT, FALSE, '' )
Call SqlSetParameter( lv_hSql2, DBP_AUTOCOMMIT, FALSE, '' )
If I use OLEDB, my source still works against SQLBase? Have I work with SqlCreateSession and SqlCommitSession?
Re: Locking behaviour against SQLServer
Look up MARS - Multiple Active Result Sets.
Search in these forums also.
Search in these forums also.
Re: Locking behaviour against SQLServer
mars=1 brings not the expected result.
-
- Site Admin
- Posts: 463
- Joined: 05 Mar 2017, 20:57
- Location: Stroud, England <--> Tauranga, New Zealand
Re: Locking behaviour against SQLServer
Of course ! SQLBase supports OLEDB just as SQLServer does, and in the same way. SQLBASEOLEDB.dll
In my opinion, OLEDB far outstrips ODBC, esp. the new 2018 SQLServer OLEDB driver .
But you need to try it for yourself to believe.

Greetings from New Zealand
Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk

Re: Locking behaviour against SQLServer
Hi guys,
I've found the problem. The tool (Full Convert from Spectral Core) that I use for converting the database from SQLBase to SqlServer, creates for the primary keys clustered indexes. If you then update with hSql1 a mastertable and want to do an insert with hSql2 an error occurs. If I create the primary key as non clustered index it works.
Thanks for your help
Ewald
I've found the problem. The tool (Full Convert from Spectral Core) that I use for converting the database from SQLBase to SqlServer, creates for the primary keys clustered indexes. If you then update with hSql1 a mastertable and want to do an insert with hSql2 an error occurs. If I create the primary key as non clustered index it works.
Thanks for your help
Ewald
Who is online
Users browsing this forum: [Ccbot] and 1 guest