NYCPHP Meetup

NYPHP.org

[nycphp-talk] how to connect to an Access db *.mdb with a DSN and without a DSN.

Kristina D. H. Anderson ka at kacomputerconsulting.com
Mon Aug 24 08:01:02 EDT 2009


Just a shot in the dark here, but you'd probably want to move the 
Access database onto a web server from your local C drive.

Also, from my recollection, DSNs are only useful if you are connecting 
through the Windows OS, so you'd have to use the full Connection 
String, i.e. a DSN-less connection, to connect on the fly through PHP.

There shouldn't be any reason that I can see why they discontinued 
support for this in PHP 5.x...

Kristina

 
> 
> Hello everyone,
> 
> This mangesh Sathe ,India.
> 
> I have one problem in db connectivity
> how to connect to an Access database *.mdb with a DSN and without a 
DSN.
> 
> I trying to do it on php 5.1 but on other sites it's maintioned that 
it
> work's only on 4.x .
> 
> sample code is,
> 
> $db = 'C:\\Program Files\\Northwind.mdb';
> 
> $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
> // Two ways to connect. Choose one.
> $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or
> exit('Cannot open with Jet.');
> //$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or
> exit('Cannot open with driver.');
> 
> Waiting yours Reply
> 
> Thanku very much
> 
> -- 
> Thanks & Regards,
> Mangesh Sathe
> 
> 








More information about the talk mailing list