pbms_pconnect
Description
resource pbms_pconnect ( [string $host [,long $port [,string $database ]]])
Establishes a connection to a PBMS daemon running on $host.

pbms_pconnect() establishes a connection to a PBMS server. The defaults for missing optional parameters are taken from the PBMS configuration settings in the PHP configuration file.

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

pbms_pconnect() acts very much like pbms_connect() with two major differences.

First, where pbms_connect() will only use a pool connection when there is one available, pbms_pconnect() will create a new pool connection and possibly a new pool if one doesn't exist and us it.

Second, the connection created by pbms_pconnect() will not be closed when the execution of the script ends. Instead, the connection will be returned to the pool and remain open for future use (pbms_close() will not close connections established by pbms_pconnect() but instead return the connection to the pool. ).

This type of connection is therefore called 'persistent'.

Note: these kind of connections only work if you are using a module version of PHP.

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 daemon. 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_pconnect() fails
  // allow error messages to be displayed.
  $val = ini_set("display_errors", "1");

  $pbms = pbms_pconnect("localhost", 8080, "A_database")
    or die("Could not connect");

  ini_set("display_errors", $val);

  // Because this is a pool session the call to pbms_close()
  // will not actually close the session but will just return
  // it to the pool for future use.
  pbms_close($pbms);
?>
		
Related functions
pbms_connect() pbms_close() pbms_connection_pool_size()