致命错误:未捕获的异常' PDOException'消息' SQLSTATE [HY000] SQLDriverConnect:-1044

时间:2016-01-26 01:55:40

标签: javascript php jquery

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.' in C:\xampp\htdocs\img\config.php:15 
Stack trace: 

#0 C:\xampp\htdocs\img\config.php(15): PDO->__construct('odbc:Driver={Mi...') 
#1 C:\xampp\htdocs\img\index.php(9): require_once('C:\\xampp\\htdocs...') 
#2 {main} thrown in C:\xampp\htdocs\img\config.php on line 15

我一直看到这个错误但我无法看到问题我正在使用ms访问数据库要求我真的需要提前建立一个基于角色的访问控制

这是代码:

error_reporting( E_ALL & ~E_DEPRECATED & ~E_NOTICE );
ob_start();
session_start();

$database = "C:\xampp\htdocs\img\multi-admin.mdb";
$DB = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$database;Uid=Admin");

define('PROJECT_NAME', 'Create Multi admin using php mysql and bootstrap library');
$dboptions = array(
              PDO::ATTR_PERSISTENT => FALSE, 
              PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, 
              PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
              PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
            );

try {
  $DB = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=$database;Uid=Admin");
} catch (Exception $ex) {
  echo $ex->getMessage();
  die;
}

require_once 'functions.php';

//get error/success messages
if ($_SESSION["errorType"] != "" && $_SESSION["errorMsg"] != "" ) {
    $ERROR_TYPE = $_SESSION["errorType"];
    $ERROR_MSG = $_SESSION["errorMsg"];
    $_SESSION["errorType"] = "";
    $_SESSION["errorMsg"] = "";
}
?>

0 个答案:

没有答案