1

You clever people can probably set me straight on this without me wasting any more time trawling the internet so here goes....

Our company still uses access 97 mdb files for some legacy applications and I would love to be able to connect and interrogate these databases using php / apache running on a Linux box. Upgrading the databases is not an option so I have to use them in the current format.

So the question is, is this even possible and if so, how would I go about it?

2
  • You can convert an Access db to MySQL if you no longer need the Access project, and only want to use PHP moving forwards. Or to answer your original question, you can use ODBC with PHP to connect to your Access db. Commented Mar 21, 2013 at 10:59
  • PHP's ODBC driver should do it, but bear in mind the constraints of using an Access DB. If this PHP system is going to need to support multiple concurrent users, an Access DB isn't designed to be able to cope with that; there's a strong probability you'll get database corruption as a result. Commented Mar 21, 2013 at 11:23

2 Answers 2

2

User Below Code :

$dbName = $_SERVER["DOCUMENT_ROOT"] . "products\\products.mdb";
if (!file_exists($dbName)) {
    die("Could not find database file.");
}
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");

You should enable PDO & ODBC extenstions in PHP.INI file.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks people. Its given me a starter. I'm using mdbtools with unixODBC. Once the information was in the odbc.ini and odbcinst.ini files I was able to link to the mdb file using: $conn=odbc_connect('dbname','',''); I think I may have uncovered a 'bug' with the odbc_exec but I will post this elsewhere. Thanks for your help and I will mark this as answered shortly.
0

Thanks people. Its given me a starter. I'm using mdbtools with unixODBC. Once the information was in the odbc.ini and odbcinst.ini files I was able to link to the mdb file using: $conn=odbc_connect('dbname','',''); I think I may have uncovered a 'bug' with the odbc_exec but I will post this elsewhere. Thanks for your help and I will mark this as answered shortly.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.