pbms_connect
Description
resource pbms_connect ( [string $host [,long $port [,string $database ]]])
Establishes a connection to a PBMS BLOB streaming server running on $host.

The defaults for missing optional parameters are taken from the PBMS configuration settings in the PHP configuration file.

When a call is made to pbms_connect() a new connection will always be opened unless pool connections are being used and there is an unused connection in the connection pool for the given set of arguments.

The connection to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling pbms_close(). The exception being pool connections which when closed are released back to the pool so that they can be used again by a future call to pbms_connect() or pbms_pconnect().

It is recommended that you always call pbms_close() after you are through using a connection so that it's resources can be freed immediately and in the case of pool connections the connection can be released back t the pool where it will be available for the next pbms_connect() or pbms_pconnect() call.

The first time a new connection is opened the PBMS BLOB streaming server will be pinged to verify that all the connection parameters, with the exception of $database, are good.

Parameters
host
The hostname or an IP address. If host is NULL or not supplied then the value pbms.default_host will be used.
port
The TCP/IP port number of the PBMS BLOB streaming server. If zero or not supplied then the value pbms.default_port will be used.
database
The database to associate with this connection. If database is NULL or not supplied then the value pbms.default_database will be used.
Return Values

On success A PBMS connection resource is returned.

On failure FALSE is returned and an error message is displayed.

Example
<?php 
	// In the event that pbms_connect() fails
	// allow error messages to be displayed.
	$val = ini_set("display_errors", "1");
 
	$pbms = pbms_connect("localhost", 8080, "A_database")
		or die("Could not connect");

	 ini_set("display_errors", $val);

	pbms_close($pbms);
?>
		
Related functions
pbms_pconnect() pbms_close()