.. highlightlang:: us .. _pq_connectdb: pq_connectdb ============ .. index:: pq_connectdb .. us.tag pq_connectdb NOTREADYENGLISH New550 postgres :ref:`pq_connectdb` makes a new connection to the database server. .. function:: db = pq_connectdb(ssConninfo) .. us.return **Return Value** *db* is the connection pointer. :ref:`pq_finish` closes the connection to the server. If :ref:`pq_finish` is not invoked the garbage collector will close the connection. (see :ref:`gc`). .. us.params **Parameters** .. uparam:: ssConninfo *ssConninfo* is a string with whitespace separated Keyword/Value pairs. The most importend keys are: .. list-table:: :header-rows: 0 * - host - Name of the host to connect to, e. g. localhost. * - hostaddr - IP address of host. * - port - TCP/IP Port Nummer. * - dbname - The database name. * - user - PostgreSQL user name to connect as. * - password - Password. .. us.example **Example** :: def test_pq_connectdb() { loadlib("rs_pq.dll") ssConnect = "host=p3200server port=5432 dbname=postgres user=postgres password=postgres"; conn = pq_connectdb(ssConnect); stat = pq_status(conn); if (stat != PQ_CONNECTION_OK) { MessageBoxError(pq_error_message(conn)); error(); } return conn; } .. us.comment **Comment** More information can be found at http://www.postgresql.org. .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.5.0 - New .. seealso:: :ref:`overview-postgresql` :sub:`id-657453`