php - How can I correct this error: Data source name not found and no default driver specified


I have a website that runs in Windows server, and it works perfectly fine. I tried to make a copy in my localhost but I get the error:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\xampp\htdocs\tdms\webfolders\secured\db_fns.php on line 29
 Could not connect to database server

line 29 contains:

function fgsdb_connect()


   $result = odbc_connect('FGS','tdms','tdms358',SQL_CUR_USE_ODBC); //---->line 29

   if (!$result) // cannot establish connection to database

     throw new Exception('Could not connect to database server');

   else // connection to database has been established

     return $result;


I am really new to odbc. the website is written in php and the database that i use in mySQL. though i figured that the database that it is trying to connect is a microsoft access MDE file. (i checked in the site in windows server.) What should i do? im sorry but i am really




It's likely the shortcut for setting ODBC data sources is pointing to the 32bit data sources instead of 64bit.

Go to control panel -> administrative tools --> select data sources(ODBC) --> then right click on that file --> go to properties --> in the shortcut tab -> change the path from




and make your connection. the driver for MS Access will work fine now.

If it doesnt work, try to connect to the ODBC with a sentence like this:

$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\YourFolder\YourFile.mdb",'Youruser', 'YourPassword');

The last 2 leave then just the the '' if you dont have any user or password




I was getting the same error on PHP 7.0.8 64bit while trying to connect to an Access .mdb.

I had to do two things:

  1. Install the 64bit version of "Microsoft Access Database Engine 2010 Redistributable" (even with Access 2016 installed I was getting your error). You can download the driver from:

    Then, if you go to the ODBC Data Source Administrator, you should notice the 64bit version.

  2. Change the driver string to:

    Driver={Microsoft Access Driver (*.mdb, *.accdb)}

Hope it helps other people.

People are also looking for solutions to the problem: php - I want the last row of all players in a specific month+year


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.