eaweb
asked on
php oracle connection error
hi,
i installed oracle 10g express on my window xp machine.
i am trying to connect the database with php (5.2.3)
here is my connection string:
$conn = oci_connect('testdb', 'testdb', 'TestDB');
but i am get the following errors displayed on my page:
Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in E:\WEBAPPS\WEBDEV\VAN\dbco nnect\orac ledbc.php on line 3
Warning: oci_parse() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 7
Warning: oci_execute() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 8
Warning: oci_fetch_all() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 10
Oracle PHP Test
Name Salary
Number of Rows:
If you see data, then it works!
Warning: oci_free_statement() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 29
Warning: oci_close() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 30
PHP Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in E:\WEBAPPS\WEBDEV\VAN\dbco nnect\orac ledbc.php on line 3 PHP Warning: oci_parse() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 7 PHP Warning: oci_execute() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 8 PHP Warning: oci_fetch_all() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 10 PHP Warning: oci_free_statement() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 29 PHP Warning: oci_close() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac lesample.p hp on line 30
what could be here the problem
i installed oracle 10g express on my window xp machine.
i am trying to connect the database with php (5.2.3)
here is my connection string:
$conn = oci_connect('testdb', 'testdb', 'TestDB');
but i am get the following errors displayed on my page:
Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in E:\WEBAPPS\WEBDEV\VAN\dbco
Warning: oci_parse() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac
Warning: oci_execute() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac
Warning: oci_fetch_all() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac
Oracle PHP Test
Name Salary
Number of Rows:
If you see data, then it works!
Warning: oci_free_statement() expects parameter 1 to be resource, null given in E:\WEBAPPS\WEBDEV\VAN\orac
Warning: oci_close() expects parameter 1 to be resource, boolean given in E:\WEBAPPS\WEBDEV\VAN\orac
PHP Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in E:\WEBAPPS\WEBDEV\VAN\dbco
what could be here the problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"everything" for php should be findable on php.net (via google) or the main index of the language reference.
ASKER
<?php
if ($c = oci_connect ("hr", "hr", "xe")) {
echo "Successfully connected to Oracle.\n";
oci_close($c);
} else {
echo "Oracle Connect Error ";
}
?>
the tns name was "xe"
do you know some site where i can get some query display sample code for php oracle just like the site asp101?