NYCPHP Meetup

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

Mangesh Sathe mangesh at ascellent.co.in
Mon Aug 24 01:07:31 EDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090824/54861ace/attachment.html>


More information about the talk mailing list