(PECL CUBRID >= 8.3.0)
cubrid_connect_with_url — Is used to establish the environment for connecting to your server
The cubrid_connect_with_url() function is used to establish the environment for connecting to your server by using connection information passed with an url string argument. If the HA feature is enabled in CUBRID, you must specify the connection information of the standby server, which is used for failover when failure occurs, in the url string argument of this function. If the user name and password is not given, then the "PUBLIC" connection will be made by default.
<url> ::= cci:CUBRID:<host>:<db_name>:<db_user>:<db_password>:[?<properties>] <properties> ::= <property> [&<propertygt;] <alternative_hosts> ::= <standby_broker1_host>:<port> [,<standby_broker2_host>:<port>] <host> := HOSTNAME | IP_ADDR <time> := SECOND
A character string that contains server connection information.
User name for the database.
User password.
Connection identifier, when process is successful.
FALSE, when process is unsuccessful.
Beispiel #1 cubrid_connect_with_url() url without properties example
<?php
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:"
$con = cubrid_connect_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);
}
?>
Beispiel #2 cubrid_connect_with_url() url with properties example
<?php
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:?althost=10.34.63.132:33088&rctime=100"
$con = cubrid_connect_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);
}
?>