Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 | 



The cubrid_commit function commits on the transaction pointed by conn_identifier, currently in progress. Connection to the server is closed after the cubrid_commit() function is called; the connection handle is still valid, though.

You can configure the default value of auto-commit mode by using CCI_DEFAULT_AUTOCOMMIT (broker parameter) upon startup of an application. If configuration on broker parameter is omitted, the default value is ON; use the cubrid_set_autocommit() function to change auto-commit mode within an application. If auto-commit mode is OFF, you must explicitly commit or roll back transaction by using cubrid_commit() or cubrid_rollback() function.


bool cubrid_commit (resource $conn_identifier)

  • conn_identifier : Connection identifier
Return Value
  • Success : TRUE
  • Failure : FALSE


$conn = cubrid_connect("", 33000, "demodb");


@cubrid_execute($conn, "DROP TABLE publishers");


$sql = <<EOD

CREATE TABLE publishers(

pub_id CHAR(3),

pub_name VARCHAR(20),

city VARCHAR(15),

state CHAR(2),

country VARCHAR(15)




if (!cubrid_execute($conn, $sql)) {

    printf("Error facility: %d Error code: %d Error msg: %s ",

cubrid_error_code_facility(), cubrid_error_code(), cubrid_error_msg());






$req = cubrid_prepare($conn, "INSERT INTO publishers VALUES(?, ?, ?, ?, ?)");


$id_list = array("P01", "P02", "P03", "P04");

$name_list = array("Abatis Publishers", "Core Dump Books", "Schadenfreude Press", "Tenterhooks Press");

$city_list = array("New York", "San Francisco", "Hamburg", "Berkeley");

$state_list = array("NY", "CA", NULL, "CA");

$country_list = array("USA", "USA", "Germany", "USA");


for ($i = 0, $size = count($id_list); $i < $size; $i++) {

    cubrid_bind($req, 1, $id_list[$i]);

    cubrid_bind($req, 2, $name_list[$i]);

    cubrid_bind($req, 3, $city_list[$i]);

    cubrid_bind($req, 4, $state_list[$i]);

    cubrid_bind($req, 5, $country_list[$i]);


    if (!($ret = cubrid_execute($req))) {





if (!$ret) {


} else {



    $req = cubrid_execute($conn, "SELECT * FROM publishers");

    while ($result = cubrid_fetch_assoc($req)) {

        printf("%-3s %-20s %-15s %-3s %-15s ",

            $result["pub_id"], $result["pub_name"], $result["city"], $result["state"], $result["country"]);







The above example will output:


P01     Abatis Publishers     New York         NY     USA

P02     Core Dump Books       San Francisco    CA     USA

P03     Schadenfreude Press   Hamburg                 Germany

P04     Tenterhooks Press     Berkeley         CA     USA

See Also