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

Do you know how can php and html interact?

0 Answers  


how many type of url?

1 Answers  


How to link one site backend to another site frontend?

0 Answers   Global Logic,


What is the difference between urlencode and urldecode ?

3 Answers  


Is empty in excel?

0 Answers  






What is a php object?

0 Answers  


What are the uses of explode() function?

0 Answers  


Tell me what does $_env means?

0 Answers  


What is interface? Why it is used?

0 Answers  


Which php function will attach one file to another?

0 Answers  


Why php language is used?

0 Answers  


If there are 10 text boxes in a form having same name, their value are different. Value of which textbox will be received on action script?

20 Answers   A1 Technology, Bajaj, DG, Genpact,


Categories