Is it possible to connect to a Microsoft Access database
without a DSN? If so, how??

Answers were Sorted based on User's Feedback



Is it possible to connect to a Microsoft Access database without a DSN? If so, how??..

Answer / binu. v. pillai

Yes, we can
<?php

//Connect access database

$con=odbc_connect("DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=" . str_replace("/", "\\", $_SERVER
["DOCUMENT_ROOT"]) . "\foldername\dbname.mdb", "db_username"
, "db_password")or die("could'nt connect database");

if (!$con) {
die('Could not connect: ' . odbc_error());
}

?>

Is This Answer Correct ?    4 Yes 1 No

Is it possible to connect to a Microsoft Access database without a DSN? If so, how??..

Answer / ramachandra dixith

ya its working niceley in my local system
still i have to check in server...

any way code is connecting database.

Is This Answer Correct ?    0 Yes 0 No

Is it possible to connect to a Microsoft Access database without a DSN? If so, how??..

Answer / ghan shyam

yes it is posible to connect ms access database without dsn

you have to provide Driver for database and database path in odbc_connect function. like :
odbc_connect(DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ="{database path}", "{db username if any}"
, "{db_password if any}") or die("could not connect to database");

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

=== represents what?

2 Answers   Ephron Systems, NetTrackers,


Describe the importance of DABA BASE ABSTRACTION LAYERS in PHP and database connection?

1 Answers  


What is the correct and the most two common way to start and finish a php block of code?

0 Answers  


How can you get the size of an image in PHP?

0 Answers  


Can we run php in apache tomcat?

0 Answers  






Which software is used to run php programs?

0 Answers  


Does PHP 5 support exceptions? State Whether True or False?

0 Answers  


How to create reusable code in php?

0 Answers  


How do I start a php session?

0 Answers  


What is $_ post in php?

0 Answers  


Do you know what is use of count() function in php?

0 Answers  


Is php 7.0 stable?

0 Answers  


Categories