[unixODBC-support] locking issue

Chauhan Bhavik-A20762 bhavik at motorola.com
Fri Dec 21 13:01:31 GMT 2007

Hi Nick,

I have doubt after referring following description for level 2.

* Level 2 - The driver is protected at the connection level. only
* one thread can be in a particular driver at one time

Does it mean unixODBC (Driver Manager and intern the driver beneath it)
will allow one thread per connection to perform driver level operation?
Or as second statement implies only one thread regardless of connection?

We have connection pool of 60 and same number of threads, it's
preferable to have single thread with single connection can enter into
the driver. It means 60 threads having 60 different connections can
enter into the driver simultaneously.

This is to avoid blocking condition happening for whole process due to
ENV level (leve 3) locking.


-----Original Message-----
From: unixodbc-support-bounces at easysoft.com
[mailto:unixodbc-support-bounces at easysoft.com] On Behalf Of Nick Gorham
Sent: Friday, December 21, 2007 4:16 PM
To: Support for the unixODBC project
Subject: Re: [unixODBC-support] locking issue

Chauhan Bhavik-A20762 wrote:

>odbcinst.ini doesn't have "Threading=0" , what is the default
>While the process was bloking, I tried with isql with the same
>datasource and it does able to connect and execute some select queries.
 * use just one mutex for all the lists, this avoids any issues
 * with deadlocks, the performance issue should be minimal, if it
 * turns out to be a problem, we can readdress this
 * We also have a mutex to protect the connection pooling code
 * If compiled with thread support the DM allows four different
 * thread strategies
 * Level 0 - Only the DM internal structures are protected
 * the driver is assumed to take care of it's self
 * Level 1 - The driver is protected down to the statement level
 * each statement will be protected, and the same for the connect
 * level for connect functions, note that descriptors are considered
 * equal to statements when it comes to thread protection.
 * Level 2 - The driver is protected at the connection level. only
 * one thread can be in a particular driver at one time
 * Level 3 - The driver is protected at the env level, only one thing
 * at a time.
 * By default the driver open connections with a lock level of 3,
 * this can be changed by adding the line
 * Threading = N
 * to the driver entry in odbcinst.ini, where N is the locking level
 * (0-3)

Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org

unixODBC-support mailing list
unixODBC-support at easysoft.com

More information about the unixODBC-support mailing list