PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile)

PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile)

MS Access 数据库连接 PHP。当找到文件时,未找到扩展名为 .accdb 的文件,但找到了 .mdb.accdb 数据库文件,并且 .mdb.accdb 文件与 php 连接,但只有 .accdb 文件未与 [=19= 连接]

给出错误:

"PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xa34 Thread 0x1794 DBC 0x2010064 Jet'., SQL state S1000 in SQLConnect in "

<?php


$filename = 'C:\Website\Account\ABC\DataBase\AccountAaravStock.accdb';

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";

}

$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$filename","","");

if($conn){
    echo "Connected";

}else{

    echo "Failed";
}

?>

ODBC 驱动程序和 DSN 信息存储在 HKEY_LOCAL_MACHINE\SOFTWARE\ODBC 注册表项中(HKEY_CURRENT_USER\SOFTWARE\ODBC 下的用户 dsn 信息).

该错误表明您无权访问该注册表项。

要更改密钥的权限,请按照these instructions:

  1. Start Registry Editor (Regedt32.exe).
  2. Select the following key in the registry:
  3. HKEY_LOCAL_MACHINE\SOFTWARE\ODBC
  4. On the Security menu, click Permissions.
  5. Type the required permissions for the account that is accessing the Web page.
  6. Quit Registry Editor.

总是back up the registry在你修改之前