Driver options

PostgreSQL Driver Notes: Details about the libdbi driver providing support for PostgreSQL backends
Prev |  | Next

# 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`, `timeout`, and `port`, as well as PostgreSQL-specific options. You only need to set options that are specific to your application -- sensible defaults will be used for all unspecified 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.

username

  The name of the user accessing the database.

password

  The password of the user accessing the database.

dbname

  The name of the database used for the initial connection. If your program must be able to connect to a fresh PostgreSQL installation, use the system database `template1`.

timeout (numeric)

  The connection timeout in seconds. If the option is not specified, or if it is 0 (zero), stale connections never time out.

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.

Prev | Home | Next
Build and install the driver |  | PostgreSQL-specific Peculiarities