Yii v2 snippet guide III

Comparing #95 with #96

Revision #96 was created by rackycz rackycz on Aug 14, 2022, 7:35:24 PM.

Microsoft Access MDB

Content

[...]
composer require codeception/module-webdriver --dev
```

PS: There is also this file [ChromeDriver](https://chromedriver.chromium.org/downloads) but I am not really sure if it is an alternative to "codeception/module-webdriver" or when to use it. I havent studied it yet.

If you want to see the code coverage, do what is described in the documentation (link above). Plus make sure that your PHP contains [xDebug](https://gist.github.com/odan/1abe76d373a9cbb15bed)! And mind the difference in settings of xDebug2 and xDebug3! If xDebug is missing, you will receive error "No code coverage driver available".

 
 
**Microsoft Access MDB**
 
---
 
Under Linux I havent suceeded, but when I install a web server on Windows (for example XAMPP Server) I am able to install "Microsoft Access Database Engine 2016 Redistributable" and use *.mdb file.
 
 
So first of all you should install the web server with PHP and you should know wheather you are installing 64 or 32bit versions. Probably 64. Then go to page [Microsoft Access Database Engine 2016 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=54920) (or find newer is available) and install correspoinging package (32 vs 64bit)
 
 
Then you will be able to use following DSN string in DB connection:
 
 
```
 
$file = "C:\\xampp\\htdocs\\Database1.mdb";
 
 
// ...
 
 
'dsn' => "odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$file;Uid=;Pwd=;",
 
'username' => '',
 
'password' => '',
 
'charset' => 'utf8',
 
 
// And use this to query a table:
 
$data = Yii::$app->db->createCommand("SELECT * FROM TableX")->queryAll();
 
var_dump($data);
 
```