unixODBC PHP Update语句错误 [英] unixODBC PHP Update statement error

查看:143
本文介绍了unixODBC PHP Update语句错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu + php + unixodbc + mdbtools处理.mdb文件.
每件事(连接+选择)都可以正常工作,但可以使用Insert或Update语句.
我的代码是这样的:

I'm using Ubuntu+php+unixodbc+mdbtools for working with .mdb file.
Every thing(connection+select) works good, but Insert or Update statements.
My code is something like this :

$mdbConnection = new \PDO("odbc:mdbdriver",$user , $password , array('dbname' =>$FileName) ); 
$SelectResult = $mdbConnection->query("Select * from Zone");

$UpdateResult = $mdbConnection->query("Update Zone Set ShahrCode = 99"); 

$SelectResult返回正确的结果,但是第二个抛出一个错误,该错误导致apache出现段错误.
我使用isql命令对其进行了测试.运行Select语句成功,但Update不成功.

$SelectResult returns correct result, but the second one throws an error that cause apache to segfault error.
I test it with isql command.Running Select statement is successful but Update is not.

#isql mdbdriver
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>Update Zone Set ShahrCode = 99
Error at Line : syntax error near Update
syntax error near Update
Got no result for 'Update Zone Set ShahrCode = 99' command
[08001][unixODBC]Couldn't parse SQL
[ISQL]ERROR: Could not SQLExecute

SQL> Update [Zone] Set ShahrCode = 99
Error at Line : syntax error near Update
syntax error near Update
Got no result for 'Update [Zone] Set ShahrCode = 99' command
[ISQL]ERROR: Could not SQLExecute

如何解决此错误? 谢谢大家

How should I fix this error ? Thanks all

推荐答案

最后我找到了解决方案:
mdbtools 尚不能写入mdb文件.

At last I found a solution :
mdbtools can not write to mdb files yet.

MDB工具当前对Access 97(Jet 3)和Windows 2000具有只读支持. 访问2000/2002(Jet 4)格式.目前正在提供写支持 进行了研究,预计第一次切割将包含在0.6中 释放.

MDB Tools currently has read-only support for Access 97 (Jet 3) and Access 2000/2002 (Jet 4) formats. Write support is currently being worked on and the first cut is expected to be included in the 0.6 release.

使用简单的已编译Java应用程序是我们的解决方案.

Using simple compiled java application is our solution.

  1. 使用 Jackcess库创建一个简单的Java项目.
  2. 为Java应用程序启用CLI参数并使用所需的功能 mdb文件.
    • 您甚至可以使用CLI参数获取mdb文件路径.
  1. Create a simple java project with Jackcess library.
  2. Enable CLI params for java application and do what you want with mdb file.
    • You can even get mdb file path with CLI params.

这篇关于unixODBC PHP Update语句错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆