From: | Lindsay Stevens <lindsay(dot)stevens(dot)au(at)gmail(dot)com> |
---|---|
To: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Is it possible to set psql connection parameters before an ODBC connection? |
Date: | 2015-03-17 04:33:37 |
Message-ID: | CAG2CW_JMDxxHJ8QTRQH0dUZQC2MLcjhUBRWcT4qcyCMUN1NHmw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Enrico | 2015-03-19 10:01:36 | Odbc through vpn |
Previous Message | Adrian Klaver | 2015-03-10 16:06:33 | Re: Compile of plsqODBC driver fails on OEL6 |