Connnecting to a MS ACCESS database
Hi,
I have tried lots of different ways but can't connect to a MS ACCESS database. All the example scripts assume the database has a password etc but what if it doesn't? I know how to connect to MySQL databases with PHP and it always connects, but don't know how to with ACCESS databases. Can someone provide some code to connect to an ACCESS database using ODBC?
Any help will be very much appresiated
JeevesBond posted this at 21:05 — 11th January 2008.
He has: 3,956 posts
Joined: Jun 2002
Am assuming you're using PHP to connect? Think you can just use "" as the username/password are blank.
<?php
$db_connection = odbc_connect(\"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=/path/to/database\", \"\", \"\", \"SQL_CUR_USE_ODBC\");
?>
If that doesn't work, try:
<?php
$db_connection = odbc_connect(\"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=/path/to/database\", \"admin\", \"\", \"SQL_CUR_USE_ODBC\");
?>
'admin' is the default user (I believe). Hope this helps.
a Padded Cell our articles site!
drew22299 posted this at 19:56 — 17th January 2008.
They have: 105 posts
Joined: Mar 2006
Thanks, that worked!
carloncho posted this at 06:47 — 27th January 2008.
They have: 17 posts
Joined: Jan 2008
What Access file version use?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.