Is it possible to set psql connection parameters before an ODBC connection?

Поиск
Список
Период
Сортировка
От Lindsay Stevens
Тема Is it possible to set psql connection parameters before an ODBC connection?
Дата
Msg-id CAG2CW_JMDxxHJ8QTRQH0dUZQC2MLcjhUBRWcT4qcyCMUN1NHmw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Is it possible to set psql connection parameters before an ODBC connection?
Список pgsql-odbc

Probably not, but I wanted to ask just in case. 

The psqlODBC ConnSettings seem to be the only way to set any psql connection parameters for an ODBC connection, but according to the docs, the ConnSettings are issued after a connection is established. If possible I'd like to set some psql connection parameters before the ODBC connection, but I can't see how to do that.

The context is an all-Windows environment, where there is one server (2008R2) running postgres which many users (Win7) on the same domain can connect to using psqlODBC with clients including MS Access 2010, SAS 9.3, and Stata 12. These clients all use a centrally stored, read-only FileDSN.

The psql connection parameters I want to set and the reasons for them are:

- krbsrvname: clients authenticate with SSPI, but the SPN happens to not use the default name of POSTGRES.

- hostaddr: for some reason, MS Access fails to connect due to DNS lookup timeout (according to the odbc comm log, anyway). The "SERVER" ODBC parameter must be the server FQDN rather than the IP so that sslmode=verify-full works. If I set a hosts record to skip the DNS lookup then Access connects OK; setting hostaddr also works. Strangely, this DNS timeout issue doesn't affect psql, pgAdmin, SAS or Stata; they all connect fine without hostaddr.

- sslrootcert: as well as SSPI I have SSL connections, which requires a root.crt file with a copy of the server certificate trust chain. Rather than copying the root.crt to each machine, sslrootcert points to a centrally stored, read-only root.crt file.

Since I can't seem to set psql parameters in the FileDSN, my current workaround is to for each user, set the user environment variables PGSERVICEFILE, which points to a centrally stored, read-only .pg_service.conf file, and PGSERVICE, which nominates the service name. The .pg_service file has the above psql connection parameters set for the named service.

This is OK since at the moment I have only one service to worry about, but were there more than one service I'd need to have users change their PGSERVICE environment variable accordingly before connecting. So if possible it would be ideal to set PGSERVICE and PGSERVICEFILE in the FileDSN as a connection parameter, or even just set the above parameters directly without a .pg_service file; either of which would remove the need to set any user environment variables.

Hopefully this makes sense!

Best regards,

Lindsay

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Compile of plsqODBC driver fails on OEL6
Следующее
От: Enrico
Дата:
Сообщение: Odbc through vpn