CUBRID 関数
PHP Manual

cubrid_connect_with_url

(PECL CUBRID >= 8.3.0)

cubrid_connect_with_urlIs used to establish the environment for connecting to your server

説明

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

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

パラメータ

conn_url

A character string that contains server connection information.

userid

User name for the database.

passwd

User password.

返り値

Connection identifier, when process is successful.

FALSE, when process is unsuccessful.

例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);
}
?>

例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);
}
?>

参考


CUBRID 関数
PHP Manual