PHP db2_prepare 更新失败
每当我执行以下代码时,ZendServers 都会记录如下所示的错误。库 KIVATEST 确实存在,文件 ORTXNPF 确实存在,并且我能够对该文件执行 select 语句就好...
[2011 年 5 月 18 日 21:30:40] PHP 警告:db2_prepare() [function. db2-prepare]:/www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php 第 38 行中的语句准备失败
[2011 年 5 月 18 日 21:30:40] PHP 警告:db2_execute() 期望参数 1 为资源, /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php 第 39 行给出的布尔值
[18-May-2011 21:30:40] PHP 致命错误:未捕获异常“异常”,消息“无法执行” /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php:40
堆栈跟踪: #0 {主要} 扔在 /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php 第 40 行
$connection = db2_connect ( "*LOCAL", "", "" );
if (! $connection) {
Throw New Exception('Could not connect');
}
//Prepare and execute the SQL statement.
[[LINE 38]] $stmt = db2_prepare ( $connection, "UPDATE KIVATEST.ORTXNPF SET otbfnm = 'AdamTest' where ottxn# = 216807" );
if (! db2_execute ( $stmt ) ) {
Throw New Exception('Could not execute');
}
Any time i execute the below code, ZendServers logs the error shown below. The library KIVATEST does exist, the file ORTXNPF does exist, and I am able to execute a select statement against this file just fine...
[18-May-2011 21:30:40] PHP Warning: db2_prepare() [function.db2-prepare]: Statement Prepare Failed in /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php on line 38
[18-May-2011 21:30:40] PHP Warning: db2_execute() expects parameter 1 to be resource, boolean given in /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php on line 39
[18-May-2011 21:30:40] PHP Fatal error: Uncaught exception 'Exception' with message 'Could not execute' in /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php:40
Stack trace:
#0 {main}
thrown in /www/zendserver/htdocs/dev/Merchandising/ResultSetTesting.php on line 40
$connection = db2_connect ( "*LOCAL", "", "" );
if (! $connection) {
Throw New Exception('Could not connect');
}
//Prepare and execute the SQL statement.
[[LINE 38]] $stmt = db2_prepare ( $connection, "UPDATE KIVATEST.ORTXNPF SET otbfnm = 'AdamTest' where ottxn# = 216807" );
if (! db2_execute ( $stmt ) ) {
Throw New Exception('Could not execute');
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定为什么提供的错误如此无用...但问题是用户对该文件具有 *USE 权限,但不是 *ALL...所以我能够 SELECT 但不能更新。
I'm not sure why the error provided was so un-helpful... but the problem turned out to be that the user had *USE authority to the file, but not *ALL... so i was able to SELECT but not UPDATE.