Connection string examples
- Last Updated: August 7, 2024
- 2 minute read
- DataDirect Connectors
- ODBC
- PostgreSQL 8.0
- Documentation
ODBC provides a method for specifying connection information via a connection string and the SQLDriverConnect API. This section provides examples of connection strings configured to use common features and functionality. You can modify and/or combine these examples to create a connection string for your environment.
In addition to the connection strings for DSN-less connections demonstrated in this section, the driver supports DSN and File DSN connection strings. See "Using a connection string" for syntax and detailed information for supported connection string types.
- User ID/password authentication
- Kerberos authentication
- Certificate-based authentication
- Entra ID using user ID and password authentication
- Entra ID using service principal authentication
- Connection Failover
- TLS/SSL client authentication
- TLS/SSL server authentication
- Proxy server
User ID/password authentication
This string includes the options used to connect with basic user ID and password authentication.
DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;HostName=MyServer;PortNumber=5432;
Database=PAYROLL;LogonID=jsmith;Password=secret;
For more information on these options and values, see User ID/password authentication.
Kerberos authentication
This string includes the options used to connect with Kerberos authentication.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;AuthenticationMethod=4;
HostName=MyServer;PortNumber=5432;Database=Payroll;GSSClient=gss123;
ServicePrincipalName=postgres/myserver.example.com@EXAMPLE.COM;LogonID=John;
For more information on these options and values, see Kerberos authentication.Certificate-based authentication
This string includes the options used to connect with certificate-based authentication.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;HostName=MyServer;
PortNumber=5432;Database=MyDB;LogonID=jsmith;AuthenticationMethod=18;
Truststore=TrustStoreName;TruststorePassword=secret;
ClientSSLCertificate=C:\abc\odbc0123.crt;ClientSSLKey=C:\abc\odbc0123.key;
HostNameInCertificate=MySubjectAltName; For more information on these
options and values, see Certificate-based authentication.Entra ID using user ID and password authentication
This string includes the options used to connect with Entra ID authentication using user ID and password.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;AuthenticationMethod=13;
AzureTenantID=1234-abcd-5678-efgh;Database=MyDB;
HostName=myserver.postgres.database.azure.com;PortNumber=1433;
LogonID=test@domain.com;Password=secret; For more information on these
options and values, see Microsoft Entra ID authentication.Entra ID using service principal authentication
This string includes the options used to connect with Entra ID authentication using service principal.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;AuthenticationMethod=36;
AzureTenantID=1234-abcd-5678-efghDatabase=MyDB;
HostName=myserver.postgres.database.azure.com;PortNumber=1433;
LogonID=1234abcd-1234-abcd-1234-abcd1234abcd;
Password=ABcdEFg/hiJkLmNOPqR01stUvWxyzYx2wvUTsrQpO=; For more information
on these options and values, see Microsoft Entra ID authentication.Connection Failover
This string configures the driver to use connection failover in conjunction with some of its optional features. It uses the user ID/password authentication method for authentication.DRIVER=DataDirect 8.0 Autonomous REST Connector;AuthenticationMethod=30;
RestConfigFile=C:/path/to/myrest.rest;User=jsmith;Password=secret; For more
information on these options and values, see Failover support.TLS/SSL client authentication
This string configures the driver to establish a connection via user ID/password authentication and use data encryption via TLS/SSL client authentication. In this configuration, sinceValidateServerCertificate=1, the driver validates the certificate sent by the
server and the host name specified by
HostNameInCertificate.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;EncryptionMethod=1;
HostName=YourServer;HostNameInCertificate=MySubjectAltName;
PortNumber=5432;Database=PAYROLL;Keystore=KeyStoreName;
KeystorePassword=YourKSPassword;ValidateServerCertificate=1;
LogonID=jsmith;Password=secret; For more information on these options and
values, see TLS/SSL client authentication.TLS/SSL server authentication
This string configures the driver to establish a connection via user ID/password authentication and use data encryption via TLS/SSL server authentication. In this configuration, sinceValidateServerCertificate=1, the driver validates the certificate sent by the
server and the host name specified by
HostNameInCertificate.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;EncryptionMethod=1;HostName=MyServer;
HostNameInCertificate=MySubjectAltName;PortNumber=5432;Database=PAYROLL;
Truststore=TrustStoreFile;TruststorePassword=TSXYZZY;
ValidateServerCertificate=1;LogonID=jsmith;Password=secret; For more
information on these options and values, see TLS/SSL server authentication.Proxy server
This string includes the options you may need to connect through a proxy server with basic user ID and password authentication.DRIVER=DataDirect 8.0 PostgreSQL Wire Protocol;HostName=MyServer;
ProxyHost=pserver;ProxyPassword=proxys3cr3t;ProxyPort=1234;
ProxyUsert=jsmith;LogonID=jsmith@abc.com;Password=secret; For more
information on these options and values, see Connection option descriptions.