ADOdb Library for PHP Manual
Prev PConnect Next

PConnect($host,[$user],[$password],[$database])

Persistent connect to data source or server $host, using userid $user and password $password. If the server supports multiple databases, connect to database $database.

We now perform a rollback on persistent connection for selected databases since 2.21, as advised in the PHP manual. See change log or source code for which databases are affected.

Returns true/false depending on connection. See Connect( ) above for more info.

Since ADOdb 2.21, we also support autoRollback. If you set:

    $conn = &NewADOConnection('mysql');
    
$conn->autoRollback = true; # default is false
    
$conn->PConnect(...); # rollback here

Then when doing a persistent connection with PConnect( ), ADOdb will perform a rollback first. This is because it is documented that PHP is not guaranteed to rollback existing failed transactions when persistent connections are used. This is implemented in Oracle, MySQL, PgSQL, MSSQL, ODBC currently.

Since ADOdb 3.11, you can force non-persistent connections even if PConnect is called by defining the constant ADODB_NEVER_PERSIST before you call PConnect.


Prev Home Next
Connect Up NConnect

Sponsored by phpLens