Home > Backend Development > PHP Tutorial > SQLSTATE[IM002] SQLDriverConnect: 零

SQLSTATE[IM002] SQLDriverConnect: 零

WBOY
Release: 2016-06-13 12:30:20
Original
1040 people have browsed it

SQLSTATE[IM002] SQLDriverConnect: 0
conn.php

<?php<br />
try {<br />
    $conn = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=".realpath("../data/data.mdb"));<br />
} catch (PDOException $e) {<br />
    echo 'Connection failed: ' . $e->getMessage();<br />
}<br />
?>
Copy after login


运行后报错提示
Connection failed: SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序

百度谷歌搜了老半天也不知道哪里设置有问题,php_pdo_odbc.dll有启用,phpinfo()也显示支持pdo/odbc等,mdb文件路径也是正确的

系统是win7sp1 x64
PHP是 5.5.7 VC11 x64 Thread Safe
Apache 是httpd-2.4.7-win64-VC11
Office 是 Office2010 x64

用PDO连接mysql数据库是正常,但连接mdb就出错,是不是我哪里设置错了,或者还需要在哪里安装或设置什么驱动

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template