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

Can we use session in mvc?

0 Answers  


how to open & closing opening period in fico

0 Answers   NS,


How can I reverse sort an array keeping the correlation between the index and value?

2 Answers   Rushmore Consultancy,


How to read a file in binary mode?

0 Answers  


Why do we use csrf token?

0 Answers  


What is uri routing?

0 Answers  


full form of php??

12 Answers   HCL,


Which function will suitably replace 'x' if the size of a file needs to be checked? $Size=x(filename);

0 Answers  


Is PHP runs on different platforms (Windows, Linux, Unix, etc.)?

0 Answers  


what is session_set_save_handler in PHP?

0 Answers  


Is strcmp case sensitive?

0 Answers  


hello all, I need some sample placement papers in lion bridge.. can anyone help me?

0 Answers   Lionbridge,


Categories