Jump to content

Access Database Connection Help


Alteczen

Recommended Posts

I'm trying to connect to a MS Access database that uses a workgroup file for security (.mdw).  I'm using the ADODB class with a DSN-less connection:

 

My code is:

 

include('adodb5\adodb.inc.php'); 
$db = 'path/to/db.mde';
$wg = 'path/to/dbSecurity.mdw';
$user = 'bob';
$pass = 'joe';

$dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$db;SystemDB=$wg;Uid=$user;Pwd=$pass;";
$conn = ADONewConnection('access');
$conn->debug = true;

$conn->Connect($dsn) or die("Connection Failed");

 

And my response:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Not a valid account name or password., SQL state 08004 in SQLConnect in C:\wamp\www\gc\adodb5\drivers\adodb-odbc.inc.php on line 60
Connection Failed.

 

I'm looking for help from someone who has experience connecting to an Access db that uses a workgroup file for security.  I've been through pages of Google results with nothing concrete that has worked. 

 

The response mentions "Not a valid account name or password".  But I'm 99% sure the user/pass is correct.  I'm hoping there is just an issue with my $dsn string.  If I change the paths to the .mde or .mdw files to something completely wrong I get the same response - thus it's possible that it's not choking on the user/pass combo.

I'd love to use a different database but it's not an option.  The database comes from another company and it's what I have to work with.

 

Thanks in advance for any tips or help you can provide!

Link to comment
https://forums.phpfreaks.com/topic/125611-access-database-connection-help/
Share on other sites

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.