In PhP5, PDO is added and unified access is adopted for different databases. It is said that PDO is used for database operations in PhP6 by default.
Access is a frequently used database, which is very convenient for small applications! After searching, but no specific connection method was found, we searched and studied. The following is the method for connecting to access through PDO: Program Code <? PHP
Try {
$ Db = new PDO ("ODBC: Driver = {Microsoft Access Driver (*. mdb)}; DBQ =". Getcwd ()." \\# dB. mdb ");
Echo "connected \ n ";
} Catch (exception $ e ){
Echo "failed:". $ e-> getmessage ();
}
?>
Connection successful! If no, check that the PDO extension is installed. Open PHP. ini and check whether the extension = php_pdo_odbc.dll
If you do not have one, you can call phpinfo () to check whether the extension is correctly installed!
Note that there must be a space in front of the string "(*. mdb)". Many people have made this mistake.