Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Php脚本查询Oracle数据库:权限不足_Php_Oracle - Fatal编程技术网

通过Php脚本查询Oracle数据库:权限不足

通过Php脚本查询Oracle数据库:权限不足,php,oracle,Php,Oracle,我试图通过PHP脚本查询远程Oracle数据库。我正在运行WAMP服务器。Oracle数据库是只读的。使用PHP脚本进行连接没有问题,但在oci_execute命令中出现错误 这是我使用的脚本: <?php $c = oci_connect("username", "password", "oracle_SID"); if (!$c) { $e = oci_error(); trigger_error('Could not connect to database: '. $e['mes

我试图通过PHP脚本查询远程Oracle数据库。我正在运行WAMP服务器。Oracle数据库是只读的。使用PHP脚本进行连接没有问题,但在oci_execute命令中出现错误

这是我使用的脚本:

<?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);

?>

以下是我在运行脚本时遇到的错误:


如果数据库是只读的,我应该能够对其运行
select*
查询,对吗?

Oracle没有数据库是“只读”的概念。与您连接的用户可能没有任何创建/插入/更新/删除权限,这将使数据库对此用户是只读的,但它是用户的属性,而不是数据库


与sql语句(
…from fdma.t_title_stage
)一起出现的错误似乎是您正在与一个用户连接,而该用户甚至没有对fdma的
t_title_stage
表的选择权限。请尝试以
fdma
的身份登录,
将t_title_stage上的select授予xxx
,其中
xxx
是您在oci_connect语句中使用的
用户名。

感谢您的回复。我检查了oracle数据库,用户确实有权选择。