Theoretical question about Sql Handles

Discussion forum about all things SqlBase or SqlTalk
aspurga
Lithuania
Posts: 146
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Theoretical question about Sql Handles

Post by aspurga » 20 Sep 2019, 11:19

Hello,

I used 4 Sql Handlers for many years, one for select, the second for update, the third for delete and fourth for insert.
Now I only use one for all operations. I see no difference whether I use one Sql Handle or whether I use 4 Sql Handles.

What is good practice for usage of Sql Handles?

Regards,

Arunas

Harald
Germany
Posts: 175
Joined: 30 Mar 2017, 06:16
Location: Rosenheim, Germany

Re: Theoretical question about Sql Handles

Post by Harald » 21 Sep 2019, 00:34

Hello Arunas,

this denpends on the application, but I would say, an average application will have 2 - 4 sql handles. You should check if you use x different connetions or 1 connection with x cursors. This is set in sql.ini (enablemultibleconnections). The difference is, if you use different connections, they will block each other if you have an uncommited update. With multible cursors, you can fetch a result in cursor b after cursor a has updated the value without a commit. If you update a value in a fetch loop, you will need at least two cursors, and you should prepare the statment with SqlPrepare before starting to fetch, and use only SqlExecute within the loop (the prepare of an SqlPrepareAndExecute takes aprox. 90% of the time, but high end databases have a statement cache).

Kind regards
Harald

Didiman
Germany
Posts: 280
Joined: 21 Mar 2017, 13:05
Location: Bremen, Germany

Re: Theoretical question about Sql Handles

Post by Didiman » 23 Sep 2019, 13:00

At least Oracle has only one Channel per Databasename in TNSNames regardless how many Handles you have. So it makes no difference if you're using one or many Handles. If you want to have independent, non blocking Handles you have to work with different DB-Names.

Greez

Andreas

aspurga
Lithuania
Posts: 146
Joined: 06 Mar 2017, 08:54
Location: Lithuania

Re: Theoretical question about Sql Handles

Post by aspurga » 24 Sep 2019, 06:37

Thanks Harald and Andreas

Arunas

Return to “SqlBase General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest