php connectivity with oracle database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yasir_memon
Forum Commoner
Posts: 48
Joined: Tue Aug 11, 2009 12:29 am

php connectivity with oracle database

Post by yasir_memon »

i want to connect with oracle data base when im using this code i am facing this error
could not find driver

$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = aktmapp)
)
)
";
$db_username = "ERP_TEST";
$db_password = "ERP_TEST";
try{
$conn = new PDO("oci:dbname=".$tns,$db_username,$db_password);
}catch(PDOException $e){
echo ($e->getMessage());
}


and when i am using this code i am facing this error

Fatal error: Call to undefined function oci_connect() in C:\wamp\www\conn.php on line 17

so kindly tell me what type of mistake is there waiting for rplies thx


$tnsName = '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = aktmapp)
)
)';


$username = 'ERP_TEST';
$password = 'ERP_TEST';

//$conn=oci_connect()
$conn=oci_connect($username,$password,'//172.16.0.2:1521/XE');

if (!$conn) {
$e = oci_error(); // For oci_connect errors pass no handle
echo '<b><font color="red">FAILED</font></b> : ' . htmlentities($e[
'message']);
} else {
echo '<b><font color="green">OK!</font></b>';
oci_close($conn);


Report this post
Post Reply