我正在嘗試使用Microsoft Access數據庫作爲演示項目,我正在考慮在CodeIgniter或CakePHP中進行操作。忽略使用Microsoft Access可能的愚蠢行爲,我無法準確計算出連接字符串如何與框架的數據庫設置相對應。在直PHP,我可以使用此代碼連接到Access數據庫:如何將MSAccess連接添加到CodeIgniter或CakePHP?
$db_connection = odbc_connect(
"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\\path\\to\\db.mdb",
"ADODB.Connection", "", "SQL_CUR_USE_ODBC"
);
如何這些字符串對應代碼點火分貝設置?這似乎並不相當的工作:
$db['access']['hostname'] = "{Microsoft Access Driver (*.mdb)}";
$db['access']['username'] = "ADODB.Connection";
$db['access']['password'] = "";
$db['access']['database'] = "\\path\\to\\db.mdb";
$db['access']['dbdriver'] = "odbc";
$db['access']['dbprefix'] = "";
$db['access']['pconnect'] = TRUE;
$db['access']['db_debug'] = TRUE;
$db['access']['cache_on'] = FALSE;
$db['access']['cachedir'] = "";
$db['access']['char_set'] = "utf8";
$db['access']['dbcollat'] = "utf8_general_ci";