Postgres, developed originally in the UC Berkeley Computer Science Department, pioneered many of the object-relational concepts now becoming available in some commercial databases. It provides SQL92/SQL3 language support, transaction integrity, and type extensibility. PostgreSQL is an open source descendant of this original Berkeley code.
PostgreSQL is available without cost. The current version is available at www.PostgreSQL.org.
Since version 6.3 (03/02/1998) PostgreSQL uses unix domain sockets. A table is shown below describing these new connection possibilities. This socket will be found in /tmp/.s.PGSQL.5432. This option can be enabled with the '-i' flag to postmaster and it's meaning is: "listen on TCP/IP sockets as well as Unix domain sockets".
Table 1. Postmaster and PHP
Postmaster | PHP | Status |
---|---|---|
postmaster & | pg_connect("dbname=MyDbName"); | OK |
postmaster -i & | pg_connect("dbname=MyDbName"); | OK |
postmaster & | pg_connect("host=localhost dbname=MyDbName"); | Unable to connect to PostgreSQL server: connectDB() failed: Is the postmaster running and accepting TCP/IP (with -i) connection at 'localhost' on port '5432'? in /path/to/file.php3 on line 20. |
postmaster -i & | pg_connect("host=localhost dbname=MyDbName"); | OK |
One can establish a connection with the following value pairs set in the command string: $conn = pg_Connect("host=myHost port=myPort tty=myTTY options=myOptions dbname=myDB user=myUser password=myPassword ");
The previous syntax of: $conn = pg_connect ("host", "port", "options", "tty", "dbname") has been deprecated.
To use the large object (lo) interface, it is necessary to enclose it within a transaction block. A transaction block starts with a begin and if the transaction was valid ends with commit or end. If the transaction fails the transaction should be closed with rollback or abort.