energy-quants / bootstrap

A repo containing scripts for bootstrapping a development environment
MIT License
0 stars 1 forks source link

Configure connection pooling for `msodbc` #22

Open dhirschfeld opened 1 year ago

dhirschfeld commented 1 year ago

Configuring pyodbc.pooling = True doesn't work for unixodbc (i.e. linux)

..therefore need to configure odbcinst.ini:

The only way to control pooling with unixodbc is to use odbcinst.ini:

  • Pooling : global
  • CPTimeout: driver
  • PoolMaxSize: global
  • PoolWaitTimeout: global
dhirschfeld commented 1 year ago

Pooling is enabled by editing the odbcinst.ini config file, and as such is enabled on a per driver basis. if its required to have some connections to a driver pooled and some not, then create two entries for the driver, and map different DSN's to the drivers. The setup to enable a pooled connection, would look like this...


[ODBC]
Trace       = No
Trace File      = /tmp/sql.log
Pooling = Yes

[INTERBASE-P] Description = Easysoft Driver for Interbase Driver = /usr/local/lib/libib6odbc.so Setup = /usr/local/lib/libib6odbcS.so FileUsage = 1 DontDLClose = 1 CPTimeout = 120

[INTERBASE] Description = Easysoft Driver for Interbase Driver = /usr/local/lib/libib6odbc.so Setup = /usr/local/lib/libib6odbcS.so FileUsage = 1 DontDLClose = 1


* http://www.unixodbc.org/doc/conn_pool.html
dhirschfeld commented 1 year ago