再次感谢您的启发性支持.I am new to programming and would like to connect to a ms-access (accdb) database using a PDO class.Environement: PHP (5.5.11) / XAMPP / Windows 7 pro. PDO driver for ODBC (win32) is enabled.class db{ protected $dbName = "C:\xampp\htdocs\BillboardsManagement\Core\config\Billboards.accdb"; protected $Uid=""; protected $Upass=""; protected $conn; public function __construct() { try{ $this -> conn = new PDO('odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=$this->$dbName;Uid=$this->$Uid;Pwd=$this->$Upass'); } catch (Exception $e) { echo "\n $e-> getMessage()\n"; } }}When I try to instantiate the class, I get the following error:Thanks in advance for your help.Updates: I understand that a similar question was answered before. But I am in a learning process. The answer to the previous post was to use adodb instead of PDO ( for reasons I totally agree with) , but I am still curious about what went wrong in my particular situation. I still cannot determine whether my code was faulty or it was some odbc driver or configuration issue. 解决方案 After lots and lots of reading, I discovered I was using the wrong version of the Microsoft Access Database Engine: The 64-bit version doesn't have the 32-bit driver for *.accdb format.Thanks again for your enlightening support. 这篇关于PHP:调试与Access数据库(.accdb)的PDO连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-26 07:54
查看更多