Reputation: 105
I am working on this project where i need to connect to the Oracle database. I am using the latest version of WAMP 2.2 and also activated all the extensions related the Oracle in PHP extensions. I have used following code for the connection to Oracle Database.
<?php
$dbHost = "192.168.0.205";
$dbHostPort="1523";
$dbServiceName = "orcl";
$usr = "system";
$pswd = "admin";
$dbConnStr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=".$dbHost.")(PORT=".$dbHostPort."))
(CONNECT_DATA=(SERVICE_NAME=".$dbServiceName.")))";
if(!$dbConn = oci_connect($usr,$pswd,'192.168.0.205:1158/em')){
$err = oci_error();
trigger_error('Could not establish a connection: ' . $err['message'], E_USER_ERROR);
}
else
{
echo "COnnected";
}
$strSQL = "SELECT SYSDATE FROM DUAL";
$stmt = oci_parse($dbConn,$strSQL);
if ( ! oci_execute($stmt) ){
$err = oci_error($stmt);
trigger_error('Query failed: ' . $err['message'], E_USER_ERROR);
};
while(oci_fetch($stmt)){
$rslt = oci_result($stmt, 1); print "<h3>query returned: ".$rslt."</h3>";
}
?>
Kindly suggest the error. Thanks in advance.
Upvotes: 1
Views: 16833
Reputation: 31637
The OCI8 PHP extension is not available in your PHP installation. See the manual of the OCI8 PHP extension for installtion instructions.
Upvotes: 1