version 2004
PGSQL_Connect (host ; port; options; tty; database; user; password) Longint
| Parameter | Type | Description | |
| host | String | Host address | |
| port | String | Port number | |
| options | String | Connection options | |
| tty | String | File or tty to get debug output from back end | |
| database | String | Database name | |
| user | String | User name | |
| password | String | Password | |
| Function result | Longint | Connection ID |
Description
The PGSQL_Connect command connects to the specified database and returns a connection ID (Longint) that is used during the connection session.
host is a String that corresponds to the PostgreSQL server's address (IP or DNS).
port is a String that corresponds to the port used by the PostgreSQL server to listen at (default is 5432).
options is a String that corresponds to the PostgreSQL connection options (please see the PostgreSQL documentation).
tty is a String that corresponds to the tty optional output options (please see the PostgreSQL documentation).
database is a String that corresponds to the PostgreSQL database name you want to connect to.
user is a String that corresponds to the PostgreSQL user.
password is a String that corresponds to the password used by the PostgreSQL user.
Example
`Init $Host:="192.168.0.1" $Tty:=" " $Options:=" " $Database:="Manager" $User:="Doug" $Password:="r74d96gRfx" `Connection PGConnID:=PGSQL_Connect($Host;$Port;$Options;$Tty;$Database;$User;$Password) If(PGConnID#0) `Successful connection ... Else `PGConnID is null, we have a connection error ... End if