Reputation: 11830
Hopefully a simple question.
error_reporting(E_ALL);
ini_set('display_errors', '1');
$c = oci_connect('whatmyusrnameis', 'whatmypwdis', 'host');
if ($c) {
echo 'connection';
}
$s = oci_parse($c, 'select * from mantis_bug_table');
oci_execute($s);
The following results in
Warning oci_execute(): ORA-00942: table or view does not exist
but the connection doesn't result in any errors and the DB table does exist and it is not empty.
Any ideas??? Thank you :).
Upvotes: 5
Views: 7872
Reputation: 52675
Typically this has one of four possible problems
select * from DB_USER.mantis_bug_table
(See Justin Cave's answer regarding SYNONYMs if you don't want qualify the tablename)You can diagnose this by running the following
SELECT * FROM ALL_TABLES WHERE UPPER(table_name) = 'MANTIS_BUG_TABLE'
Upvotes: 10
Reputation: 231751
MANTIS_BUG_TABLE
table?If the table is owned by some other user, you could try fully qualifying the table name
$s = oci_parse($c, 'select * from owner_of_table.mantis_bug_table');
If the user your PHP script is using doesn't have access to the table, you'll need a DBA or the owner of the table to
GRANT SELECT ON owner_of_table.mantis_bug_table
TO whatmyusernameis;
If you have access to the table and fully qualifying the table name works but you don't want to have to fully qualify the table name every time, you can create a synonym
CREATE [PUBLIC] SYNONYM mantis_bug_table
FOR owner_of_table.mantis_bug_table
A public synonym allows all users with access to the table to reference it without using a fully qualified name. A private synonym allows just the owner of the synonym (i.e. whatmyusernameis) to reference the table without a fully qualified table name.
Upvotes: 3
Reputation: 7504
You should point scheme in connection string like:
oci_connect('whatmyusrnameis', 'whatmypwdis', 'host/**YOUR_DB**');
Look at http://www.php.net/manual/en/function.oci-connect.php in section connection_string
Upvotes: -1