[Microsoft] [ODBC driver manager] no data source name is found and default driver error information is not specified:
Source: Microsoft ole db Provider for ODBC Drivers
Description: [Microsoft] [ODBC driver manager] no data source name found and default driver not specified
Conn code:
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"). '
' . $this->siteCode; } }
Output path:
echo realpath("include/Database.mdb");
Result:
D:\PHP_Site\HouyuanMDB\include\Database.mdb
System environment
Win7 x64, php 5.5, apache2.4.9;
I just want php to connect to an ACCESS database. The path is absolutely correct. The same is true for downloading other people's ACCESS examples. it is estimated that it is not a code error. PHP is also configured. Baidu and Google have no choice but to seek help;
Reply to discussion (solution)
What is the cause ???
1. the odbc data source should be a system data source.
You don't know why
2. modify "DRIVER = {Microsoft Access Driver (*. mdb, *. accdb)}; DBQ ="
Is "Provider = Microsoft. Jet. OLEDB.4.0; Data Source ="
Try
3. the directory where the mdb file is located must have full control of the general user.
1. the odbc data source should be a system data source.
You don't know why
2. modify "DRIVER = {Microsoft Access Driver (*. mdb, *. accdb)}; DBQ ="
Is "Provider = Microsoft. Jet. OLEDB.4.0; Data Source ="
Try
3. the directory where the mdb file is located must have full control of the general user.
After modification, the following error occurs:
Source: ADODB. Connection
Description: no provider is found. The program may not be correctly installed.
The directory where the mdb file is located (the entire WEB folder) has set Everyone read/write
You must have the "execution" permission.
You must have the "execution" permission.
It is already "full control of permissions". I suspect the PHP configuration problem, but I cannot find the problem.
What is your access version?
Create a file-type data source in ODBC manager to check whether your connection string is the same as yours.
What is your access version?
Create a file-type data source in ODBC manager to check whether your connection string is the same as yours.
File DSN content
[ODBC]DRIVER=Microsoft Access Driver (*.mdb, *.accdb)UID=adminUserCommitSync=YesThreads=3SafeTransactions=0PageTimeout=5MaxScanRows=8MaxBufferSize=2048FIL=MS AccessDriverId=25DefaultDir=D:\PHP_Site\HouyuanMDB\includeDBQ=D:\PHP_Site\HouyuanMDB\include\Database.mdb
Is php_com_dotnet.dll 32-bit or 64-bit ??
I am very grateful to the xuzuning moderator for his enthusiastic help. The problem is solved by the configuration file problem. I downloaded a configuration file from the official website and then followed the original configuration, it's okay, too.