Jump to content

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

Ok - I found something, and for anyone who might also need to do this...

 

http://aspn.activestate.com/ASPN/Cookbook/PHP/Recipe/123709

 

This is a bit more complex than I would have hoped, but it certainly seems like the path I need to take.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.