php8.5
Home/ Manual/ ibm_db2 / functions/ db2_pclose

db2_pclose

PHP function Edit on GitHub ✎

(PECL ibm_db2 >= 1.8.0)

Closes a persistent database connection

Description

db2_pclose(resource $connection): bool

This function closes a DB2 client connection created with db2_pconnect() and returns the corresponding resources to the database server.

Note

This function is only available on i5/OS in response to i5/OS system administration requests.

If you have a persistent DB2 client connection created with db2_pconnect(), you may use this function to close the connection. To avoid substantial connection performance penalties, this function should only be used in rare cases when the persistent connection has become unresponsive or the persistent connection will not be needed for a long period of time.

Parameters

connection

Specifies an active DB2 client connection.

Return Values

Success

Examples

Closing a persistent connection

The following example demonstrates a successful attempt to close a connection to an IBM DB2 i5/OS database.

php
<?php
$conn = db2_pconnect('', '', '');
$rc = db2_pclose($conn);
if ($rc) {
    echo "Connection was successfully closed.";
}
?>

The above example will output:

output
Connection was successfully closed.

See Also

Source: reference/ibm_db2/functions/db2-pclose.xml · from the official PHP manual (php/doc-en)