cubrid_pconnect_with_url

Description

The cubrid_pconnect_with_url function configures the persistent connection to a database server.

The cubrid_pconnect_with_url function is working similar to the cubrid_connect_with_url function but there are two differences as follows:

Syntax

resource cubrid_pconnect_with_url( string $conn_url[, string $userid[, string $passwd]] )

 

<conn_url> ::= [cci:]CUBRID:<host>:<db_name>:<db_user>:<db_password>:[?<properties>]

<properties> ::= <property> [&<property>]

<property> ::= autocommit=<autocommit_mode>

<property> ::= althosts=<alternative_hosts> [ &rctime=<time>]

<property> ::= login_timeout=<milli_sec>

<property> ::= query_timeout=<milli_sec>

<property> ::= disconnect_on_query_timeout=true|false

 

<alternative_hosts> ::= <host>:<port>[, <host>:<port>]

<host> := HOSTNAME | IP_ADDR

 

<time> := SECOND

<milli_sec> := MILLISECOND

Return Value
Example

Example #1 cubrid_pconnect_with_url() url without properties example

<?php

$conn_url = "CUBRID:127.0.0.1:33000:demodb:dba:123456:?autocommit=off"

$con = cubrid_pconnect_with_url ($conn_url);

 

if ($con) {

echo "connected successfully";

$req =cubrid_execute($con, "insert into person values(1,'James')");

 

if ($req) { cubrid_close_request ($req); cubrid_commit ($con); } else { cubrid_rollback ($con); }

cubrid_disconnect ($con);

}

?>

 

Example #2 cubrid_pconnect_with_url() url with properties example

<?php

$conn_url = "CUBRID:127.0.0.1:33000:demodb:dba:123456:?autocommit=off&althost=10.34.63.132:33088&rctime=100"

$con = cubrid_pconnect_with_url ($conn_url);

 

if ($con) {

echo "connected successfully";

$req =cubrid_execute($con, "insert into person values(1,'James')");

 

if ($req) { cubrid_close_request ($req); cubrid_commit ($con); } } else { cubrid_rollback ($con); }

cubrid_disconnect ($con);

}

?>