Chapter 3. Driver options

Before you can initiate a connection, you must usually specify options that tell the database driver what to connect to. This driver supports the standard options of host, username, password, dbname, and port. You only need to set options that are specific to your application -- sensible defaults will be used for all unspecified options.

This driver also offers the following non-standard options, and/or redefines the meaning of the following standard options:

host

If this begins with a slash, it specifies Unix-domain communication rather than TCP/IP communication; the value is the name of the directory in which the socket file is stored. The default behavior when host is not specified is to connect to a Unix-domain socket in /tmp (or whatever socket directory was specified when PostgreSQL was built).

port

Port number to connect to at the server host, or socket file name extension for Unix-domain connections.

encoding

The IANA name of a character encoding which is to be used as the connection encoding. Input and output data will be silently converted from and to this character encoding, respectively. The list of available character encodings depends on your local PostgreSQL installation. If you set this option to "auto", the connection encoding will be the same as the database encoding.

pgsql_foo

Pass option foo directly to libpq. For valid options, refer to the libpq documentation.