Tuesday, July 17, 2007

PHP Oracle Connectivity

A simple code to connect to Oracle from PHP

$c=OCILogon("scott", "tiger", "orcl");
if ( ! $c )
{
echo "Unable to connect: " . var_dump( OCIError() );
die();
}

print("Connected to Oracle!!");

In the above code, 'scott' is a pre-defined user with 'tiger' as its password. 'orcl' is the Oracle SID that was selected on installation.

For more information on PHP-Oracle connectivity, please refer: http://www.orafaq.com/faq/php

No comments: