Jump to content

[SOLVED] MS Access files with php - Impossible?


Edgewalker81

Recommended Posts

After several hours of searching, I don't believe this is possible, but so far I haven't been told that specifically, so I'd like to know.

 

It's like this:

I'm running Apache/MySQL/PHP and recently my boss wanted me to create some pages that interface with the database files from another part of the company, and they're all Microsoft Access .mdb files sitting on a network drive.  It easy to use ODBC to get at one file, but I need the ability to arbitrarily access files . ODBC is NOT an option, because  there are at least 120 different .mdb files in system.  Also, changing from Access to MySQL for them is not an option- our software there doesn't support it.

 

Advice?  Is this even POSSIBLE with php?  Is there a server-side language that I could pick up that would be much better for this?  (Preferably one that wouldn't cause me to have to dump Apache)

 

Thanks!

-Jason

That code does not work, either.  It gives me just a blank page starting from the point where it attempts to connect to the database file.  Any code on earlier lines works as normal.  Here it is for reference:

 

<?PHP

$conn = new COM("ADODB.Connection") or die("Cannot start ADO");

 

// Microsoft Access connection string.  The file is in the same directory as this script

$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=Sample.mpq");

 

// SQL statement to build recordset.

$rs = $conn->Execute("SELECT SchoolName FROM Schools");

 

// Display all the values in the records set

while (!$rs->EOF) {

    $fv = $rs->Fields("SchoolName");

    echo "Value: ".$fv->value."<br>\n";

    $rs->MoveNext();

}

$rs->Close();

?>

The PHP reference was the first place I looked, but thank you for the suggestion.  It's really not helpful unless I want to do one of two things:  Make a MySQL database which synchronizes with the access db (not an option, I'd need to make 150 of them) or use ODBC in Windows and assign a DSN, which is ALSO not an option, because there are over 150 .mdb files, and the number and names changes periodically.  I need to be able to access them arbitrarily without complex setup and lots of overhead.

 

Edit: Fixed a typing error

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.