Skip to content

Secure Connections for ODBC Clients

By default, the PostgreSQL ODBC driver uses the YBSSLMODE or PGSSLMODE environment variable to determine if SSL is to be used. If SSL is going to be used, the connection uses the root.crt file in the default location (if it exists) or the root.crt file pointed to by the YBSSLROOTCERT environment variable.

If you are not using environment variables for SSL-related connection settings or want to override the values in use, you can set the connection properties in the Windows DSN GUI, in the odbc.ini file, or via "DNS-less" ODBC libpq connection properties (depending upon your connection type).

Example: Windows UI

You can specify the SSL mode to use in the ODBC driver setup:

You can specify an alternative sslrootcert by setting the libpq connection parameters with conninfo style strings in the ODBC driver configuration UI (Tab3 libpq parameters). For example:

sslrootcert=c:\\ybd\\yb_root_certs.crt

Note that the property Allow connections unrecoverable by MSDTC? is set to yes. Do not use the connection test option; you will get a misleading error. Instead, use the Test button in the general Setup dialog (as shown earlier).

Example: ODBC DSN-less Connection String

This example shows a DNS-less connection string with require SSL mode and a specific root cert.

Driver={PostgreSQL ANSI};Server=IP address;Port=5432;Database=myDataBase;
Uid=myUsername;Pwd=myPassword;sslmode=require;sslrootcert=~/ybd/yb_root_certs.crt

Example: odbc.ini DSN

This example shows an odbc.ini DSN with verify-ca trust and a specific root cert.

[YB14YellowbrickSSLWithRootCRT]
Driver = /usr/local/lib/psqlodbcw.so
Description = YB14
Database = yellowbrick
Servername = yb14
SSLMode = verify-ca
SSLRootCert = /home/my_user_name/ybd/yb14_root.crt

Parent topic:Secure Connections for ODBC/JDBC Clients and ybsql