PHP.nl

oci_new_connect

oci_new_connect

Connect to the Oracle server using a unique connection

 **oci_new_connect** string $username string $password  $connection_string string $encoding int $session_mode

Establishes a new connection to an Oracle server and logs on.

Unlike and , does not cache connections and will always return a brand-new freshly opened connection handle. This is useful if your application needs transactional isolation between two sets of queries. oci_connect``oci_pconnect``oci_new_connect

usernameThe Oracle user name.

password The password for . username

connection_string``encoding``session_mode

Returns a connection identifier or false on error.

The following demonstrates how you can separate connections.

Voorbeeld: example

<?php

// create table mytab (mycol number);

function query($name, $c)
{
    echo "Querying $name\n";
    $s = oci_parse($c, "select * from mytab");
    oci_execute($s, OCI_NO_AUTO_COMMIT);
    $row = oci_fetch_array($s, OCI_ASSOC);
    if (!$row) {
        echo "No rows\n";
    } else {
        do {
            foreach ($row as $item)
                echo $item . " ";
            echo "\n";
        } while (($row = oci_fetch_array($s, OCI_ASSOC)) != false);
    }
}

$c1 = oci_connect("hr", "welcome", "localhost/orcl");
$c2 = oci_new_connect("hr", "welcome", "localhost/orcl");

$s = oci_parse($c1, "insert into mytab values(1234)");
oci_execute($s, OCI_NO_AUTO_COMMIT);

query("basic connection", $c1);
query("new connection", $c2);
oci_commit($c1);
query("new connection after commit", $c2);

// Output is:
//   Querying basic connection
//   1234 
//   Querying new connection
//   No rows
//   Querying new connection after commit
//   1234 

?>
See  for further examples of parameter usage.

oci_connect

oci_connect``oci_pconnect