[英]Querying an Oracle Database via Php Script: Insufficient Privileges
I'm trying to query a remote Oracle database through a PHP script. 我正在尝试通过PHP脚本查询远程Oracle数据库。 I'm running WAMP server. 我正在运行WAMP服务器。 The Oracle database is read only. Oracle数据库是只读的。 I have no problem connecting using the PHP script but I get errors on the oci_execute command. 使用PHP脚本进行连接时没有问题,但是在oci_execute命令上出现错误。
This is the script I use: 这是我使用的脚本:
<?php
$c = oci_connect("username", "password", "oracle_SID");
if (!$c) {
$e = oci_error();
trigger_error('Could not connect to database: '. $e['message'],E_USER_ERROR);
}
$s = oci_parse($c, 'Select * from fdma.t_title_stage');
if (!$s) {
$e = oci_error($c);
trigger_error('Could not parse statement: '. $e['message'], E_USER_ERROR);
}
$r = oci_execute($s);
if (!$r) {
$e = oci_error($s);
trigger_error('Could not execute statement: '. $e['message'], E_USER_ERROR);
}
oci_free_statement($stid);
oci_close($conn);
?>
These are the errors I'm getting when I run the script: 这些是我运行脚本时遇到的错误:
If the database is read-only I should be able to run a select *
query against it, right? 如果数据库是只读的,我应该能够对它运行select *
查询,对吗?
Oracle has no concept of a database being "read-only". Oracle没有将数据库设为“只读”的概念。 The user you're connecting with may not have any create/insert/update/delete rights, which would make the database read-only to this user, but it's a property of the user, not the database. 与您连接的用户可能没有任何创建/插入/更新/删除权限,这将使该数据库对该用户只读,但这是该用户的属性,而不是数据库的属性。
The error you're getting, in conjunction with the sql statement ( ... from fdma.t_title_stage
) seems like you're connecting with a user that doesn't even have select rights on fdma's t_title_stage
table. 您收到的错误与sql语句( ... from fdma.t_title_stage
)结合在一起,好像您正在连接的用户甚至对fdma的t_title_stage
表没有选择权限。 Try loggin in as fdma
, the grant select on t_title_stage to xxx
with xxx
being the username
you're using in your oci_connect statement. 尝试以fdma
grant select on t_title_stage to xxx
的grant select on t_title_stage to xxx
其中xxx
是您在oci_connect语句中使用的username
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.