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

How can you declare the array in php?

0 Answers  


Can you specify the "new line" character in single-quoted strings?

0 Answers  


What is a session in php?

0 Answers  


What is string and its function?

0 Answers  


What is php mainly used for?

0 Answers  






How to convert a string to uppercase in php?

0 Answers  


How we load all classes that placed in different directory in one php file , means how to do auto load classes.

0 Answers  


What is php session and how it works?

0 Answers  


What is new static in php?

0 Answers  


How to find the length of a string?

0 Answers  


Does wordpress run on php 7?

0 Answers  


What are computer variables?

0 Answers  


Categories