PostgreSQL ODBC connection string parameters

The following table describes the key connection string parameters for connecting to PostgreSQL via the ODBC driver.

Basic settings

Parameter Description
Server The host name or IP address of the PostgreSQL server.
Port The port number for the connection. The default value is 5432.
User ID The PostgreSQL username.
Password The PostgreSQL password.
Database The name of the database to connect to.
Schema The name of the schema to use.

Advanced settings

Parameter Description
Allow NULL strings Allows NULL values to be passed to metadata retrieval functions, ensuring compatibility with third-party tools that send NULL where the ODBC specification requires a value. The default value is True.
Charset Specifies the character set for the driver to use when reading and writing character data.
Connection Timeout Specifies the time (in seconds) to wait for a connection to open before terminating an attempt. The default value is 15.
Empty strings as NULL Treats empty strings as NULL values when passed to metadata retrieval functions, ensuring compatibility with third-party tools that pass empty strings instead of NULL. The default value is False.
EnablePgGIS Enables support for the PostGIS extension in PostgreSQL. The default value is False.
IP Version Specifies the Internet Protocol version to use for the connection. Available values:
  • ivIPv4 – (Default) Uses Internet Protocol Version 4 (IPv4).
  • ivIPv6 – Uses Internet Protocol Version 6 (IPv6).
  • ivIPBoth – Uses either Internet Protocol Version 6 (IPv6) or Version 4 (IPv4). If IPv6 is enabled in the operating system, a connection attempt is made via IPv6; if it fails, a new connection attempt is made via IPv4.
MinFetchRows Controls the minimum number of rows the driver fetches from the server during query execution.
  • If the value of the SQL_ATTR_ROW_ARRAY_SIZE attribute is less than MinFetchRows, the driver fetches MinFetchRows rows.
  • If SQL_ATTR_ROW_ARRAY_SIZE is greater than or equal to MinFetchRows, the driver fetches the number of rows specified by SQL_ATTR_ROW_ARRAY_SIZE.
To ensure the driver fetches exactly the number of rows specified by SQL_ATTR_ROW_ARRAY_SIZE, set MinFetchRows to 0.
Note: The default value of SQL_ATTR_ROW_ARRAY_SIZE is 1, which may significantly reduce performance if MinFetchRows is set to 0.
Multiple Connections Enables the driver to open parallel connections to the database. The default value is False.
ODBC Behavior Specifies the ODBC specification version the driver must conform to, based on the expectations of a third-party tool.
Typically, the driver’s behavior is controlled by setting the SQL_ATTR_ODBC_VERSION attribute via the SQLSetEnvAttr function. However, some third-party tools expect the driver to behave according to ODBC 2.x standards, but either fail to set this attribute or pass an incorrect value.
In such cases, you can explicitly define the required behavior in the connection string using the ODBC Behavior parameter. Available values:
  • Default – (Default) Uses the default behavior as determined by the third-party tool.
  • Ver 2.x – Forces the driver to use ODBC 2.x behavior.
  • Ver 3.x – Forces the driver to use ODBC 3.x behavior.
Protocol Specifies the PostgreSQL protocol version to use for communication with the server.
Read Only Specifies whether to prevent data from being modified. The default value is False.
RegionalDateTimeSettings Enables local regional settings for converting dates and times to strings. The default value is False.
RegionalNumberSettings Enables local regional settings for converting numbers to strings. The default value is False.
String Types Specifies the type of string data returned:
  • Default – (Default) The driver determines the appropriate string types.
  • Ansi – Returns string data as SQL_CHAR, SQL_VARCHAR, and SQL_LONGVARCHAR.
  • Unicode – Returns string data as SQL_WCHAR, SQL_WVARCHAR, and SQL_WLONGVARCHAR.
UseUnicode Enables Unicode (UTF-8) support for string data. The default value is False.
Uuid With Braces Specifies whether to display UUIDs (Universally Unique Identifiers) in curly braces. The default value is True.

Sample connection string

DRIVER={Devart ODBC Driver for PostgreSQL};Server=myServer;User ID=myUsername;Password=myPassword;Database=myDatabase;Schema=mySchema