0

Hello guys, I have a school assignment and I need to develop a site with Microsoft Access database, but I have no clue how to set up and use that database, I searched eveywhere on the internet and I haven't found anything concludent, all explications are foggy and I can't understand them. Can you please explain what $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;"); means?.
Exactly what does "dbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;" mean and how do I find it in my computer, or do I have to install a driver ? Please help me, I really need your help.

Edited by pritaeas: Added markdown.

3
Contributors
4
Replies
28
Views
4 Years
Discussion Span
Last Post by Webville312
0

"Driver" points to the installed windows driver needed to access the MSAccess database. Most likely this is already installed if you are running on a Windows machine. $dbName is a variable that should contain the name of the database you are trying to open.

0

Sorry for asking but I am a bit newbie with Microsoft Acces, but where is this driver located ?

0

Create your Access database and populate it.
You will need to install ODBC before you can access your database by downloading it from;
http://dev.mysql.com/downloads/connector/odbc/

Upon installing it, then follow the following instructions;
1. Go to your control panel and Open the Administrative Tools icon in your Control Panel.
2. Double-click on the Data Sources (ODBC) icon inside.
3. Choose the System DSN tab.
4. Click on Add in the System DSN tab.
5. Select the Microsoft Access Driver. Click Finish.
6. In the next screen, click Select to locate the database.
7. Give the database a Data Source Name (DSN).
8. Click OK.

Then you can connect to your database. Note that you only need to connect to the datasource and NOT the database itself like so;

$conn=odbc_connect('data_source','','');
$sql="SELECT * FROM customers";
$rs=odbc_exec($conn,$sql);

Hope that helps

Edited by Webville312: Editing the codes

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.