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 BLOB streaming server 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.
On success A PBMS connection resource is returned.
On failure FALSE is returned and an error message is displayed.
<?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 actuall close the session but will just return // it to the pool for future use. pbms_close($pbms); ?>