Re: Multiples connections is locking

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2009/12/16 João Marcelo Loureiro do Amaral <[email protected]>:
> Hi Frediano, I need your help, please!
> I built an application using unixODBC with FreeTDS (SQLServer 2000). And I
> found a critical problem when I use multiple connections!
> I built a Stored Procedure in my BD that stays in slow loop, and I built an
> other Stored Procedure that returns very quickly.
> I created a thread (posix) to execute the first procedure, and I created an
> other thread to execute the second procedure (that returns fast).
> I am not sharing any handles between the threads (Enviroment, Connection or
> Statement) and I am not using mutex control, but the second thread locks
> when try to use any handle (Enviroment by example).
> First I created thread that executes slow procedure, and after 1 second, I
> create thread that executes fast procedure. But the second procedure only
> returns after the first ends.
> I built same example in ODBC32 and works well!
> Please help me!
> I am migrating from windows to linux, and I am needing this very much! Any
> help are welcome!
> Sorry by my english...
>

.... omissis ...

It's a known problem. By default unixODBC apply a threading model 3
that serialize every calls of a driver. It's safe to use a threading
of 1. To specify this however you have to use odbcinst.ini like

/etc/odbcinst.ini

[FreeTDS]
Driver = /path/to/our/libtdsodbc.so
Threading = 1

and in odbc specify the driver using odbcinst.ini, like

/etc/odbc.ini (or ~/.odbc.ini or another file with overriding)

[dsnname]
Driver = FreeTDS
Server = dns_server_name
Port = your_port
TDS_Version = 8.0

or use a connect string with driver parameter like

"DRIVER=FreeTDS;SERVER=dns_server_name;PORT=your_port;TDS_Version=8.0"

freddy77
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.