cci_connect_with_url

Description

The cci_connect_with_url function connects a database by using connection information passed with an url string argument. If CUBRID HA is enabled in CCI, 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 it has succeeded, the ID of connection handle is returned; if it fails, an error code is returned.

Syntax

int cci_connect_with_url (char *url [, char *db_user, char *db_password ])

 

<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> := MILLI SECOND

Return Value
Error Codes
Example

--connection URL string when a property(althosts) specified for HA

URL=cci:CUBRID:192.168.0.1:33000:demodb:::?althosts=192.168.0.2:33000,192.168.0.3:33000

 

--connection URL string when properties(althosts,rctime) specified for HA

URL=cci:CUBRID:192.168.0.1:33000:demodb:::?althosts=192.168.0.2:33000,192.168.0.3:33000&rctime=600

Remark

Because a colon (:) and a question mark (?) are used as a separator in URL string, it is not allowed to include them for password of URL string. To use them, you must specify a user name (db_user) and a password (db_passwd) as a separate parameter.