PHP Fatal error:  Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> \xb2\xd9\xd7\xf7\xd2\xd1\xb1\xbb\xc8\xa1\xcf\xfb\xa1\xa3' in D:\\Software\\wamp\\www\\test.php:5\nStack trace:\n#0 D:\\Software\\wamp\\www\\test.php(5): com->Open('DRIVER={Microso...')\n#1 {main}\n  thrown in D:\\Software\\wamp\\www\\test.php on line 5<?php
//phpinfo();
$conn=new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("/cq.mdb");
$conn->Open($connstr) or die("AAA") ;//问题出现在here?>连接不成功,求帮助。PHP异常

解决方案 »

  1.   

    realpath("/cq.mdb") 这个有问题realpath 是获取文件的绝对路径,如果文件不存在,则返回空
    你的文件为 /cq.mdb,显然是不对的,没有人会把数据库文件放在文件系统的根目录上请检查你的库文件的位置 
      

  2.   

    路径之类没问题,关键看
    PHP Fatal error:  Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> \xb2\xd9\xd7\xf7\xd2\xd1\xb1\xbb\xc8\xa1\xcf\xfb\xa1\xa3' in D:\\Software\\wamp\\www\\test.php:5\nStack trace:\n#0 D:\\Software\\wamp\\www\\test.php(5): com->Open('DRIVER={Microso...')\n#1 {main}\n  thrown in D:\\Software\\wamp\\www\\test.php on line 5
      

  3.   

    \xb2\xd9\xd7\xf7\xd2\xd1\xb1\xbb\xc8\xa1\xcf\xfb\xa1\xa3
    操作已被取消。注意:这并不是因为出现了错误,而是因为目标文件未指定,他无事可做!