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

Is it more secure to use cookies to transfer session ids?

0 Answers  


What is the difference between characters 34 and x34?

0 Answers  


How do I install php?

0 Answers  


when we use ob_start() function in php then the header() and session_start() does not gives the error like header already sent,please explain in brief

2 Answers  


Which cryptographic functions in php returns the longest hash value?

0 Answers  






Explain the difference between unlink() and unset()?

0 Answers  


What is the use of die in php?

0 Answers  


What is an example of a variable?

0 Answers  


What are regular expressions in programming?

0 Answers  


What is static method php?

0 Answers  


What is php resource type?

0 Answers  


What is variable declaration?

0 Answers  


Categories