<replaceable>connection_user</replaceable>
DATABASE <replaceable>connection_target</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
The <command>CONNECT</command> command establishes a connection
between the client and the PostgreSQL server.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry id="ecpg-sql-connect-connection-target">
<term><replaceable class="parameter">connection_target</replaceable></term>
<listitem>
<para>
<replaceable class="parameter">connection_target</replaceable>
specifies the target server of the connection on one of
several forms.
<variablelist>
<varlistentry id="ecpg-sql-connect-connection-target-database-name">
<term>[ <replaceable>database_name</replaceable> ] [ <literal>@</literal><replaceable>host</replaceable> ] [ <literal>:</literal><replaceable>port</replaceable> ]</term>
<listitem>
<para>
Connect over TCP/IP
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-target-unix-domain-sockets">
<term><literal>unix:postgresql://</literal><replaceable>host</replaceable> [ <literal>:</literal><replaceable>port</replaceable> ] <literal>/</literal> [ <replaceable>database_name</replaceable> ] [ <literal>?</literal><replaceable>connection_option</replaceable> ]</term>
<listitem>
<para>
Connect over Unix-domain sockets
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-target-tcp-ip">
<term><literal>tcp:postgresql://</literal><replaceable>host</replaceable> [ <literal>:</literal><replaceable>port</replaceable> ] <literal>/</literal> [ <replaceable>database_name</replaceable> ] [ <literal>?</literal><replaceable>connection_option</replaceable> ]</term>
<listitem>
<para>
Connect over TCP/IP
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-target-constant">
<term>SQL string constant</term>
<listitem>
<para>
containing a value in one of the above forms
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-target-host-variable">
<term>host variable</term>
<listitem>
<para>
host variable of type <type>char[]</type>
or <type>VARCHAR[]</type> containing a value in one of the
above forms
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-name">
<term><replaceable class="parameter">connection_name</replaceable></term>
<listitem>
<para>
An optional identifier for the connection, so that it can be
referred to in other commands. This can be an SQL identifier
or a host variable.
</para>
</listitem>
</varlistentry>
<varlistentry id="ecpg-sql-connect-connection-user">
<term><replaceable class="parameter">connection_user</replaceable></term>
<listitem>
<para>
The user name for the database connection.
</para>
<para>
This parameter can also specify user name and password, using one the forms
<literal><replaceable>user_name</replaceable>/<replaceable>password</replaceable></literal>,
<literal><replaceable>user_name</replaceable> IDENTIFIED BY <replaceable>password</replaceable></literal>, or
<literal><replaceable>user_name</replaceable> USING <replaceable>password</replaceable></literal>.
</para>
<para>
User name and password can