Skip to Content.
Sympa Menu

freetds - Re: [freetds] Multiples connections is locking

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Multiples connections is locking
  • Date: Wed, 16 Dec 2009 13:52:27 +0100

2009/12/16 João Marcelo Loureiro do Amaral <joaomarcelobsb AT gmail.com>:
> 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




Archive powered by MHonArc 2.6.24.

Top of Page