[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序,该怎么解决

不言
Release: 2023-02-28 13:48:02
Original
13727 people have browsed it

  [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
错误信息:
Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序
conn代码:

 function conn(){
        try {
            $this->conn = new com("ADODB.Connection");
            $this->conn->Open("DRIVER={Microsoft Access Driver (*.mdb,*.accdb)}; DBQ=" . realpath("include/Database.mdb"));
            //$this->conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($this->dbPath).";Uid=;Pwd=".$this->dbPWD.";");
            $this->showMessage = $this->siteCode;
        }
        catch(Exception $e){
            $this->showMessage = mb_convert_encoding($e->getMessage(), "UTF-8", "GBK"). '
Copy after login

输出路径:

echo realpath("include/Database.mdb");
Copy after login

结果:

D:\PHP_Site\HouyuanMDB\include\Database.mdb
Copy after login

系统环境
win7 x64,php 5.5,apache2.4.9;

我只是想php连接个ACCESS数据库,路径绝对无错,下载别人的ACCESS例子也是一样,估计不是代码错,PHP也配置了,自行百度谷歌无果后唯有求助;
------解决方案--------------------
1、odbc 数据源应该是 系统数据源
你并没有用到,不知为何展示
2、改 "DRIVER={Microsoft Access Driver (*.mdb,*.accdb)}; DBQ="
为 "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
一试
3、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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!