当前位置:   article > 正文

mysql 未发现数据源名称并且未指定默认驱动程序,如何纠正此错误:未找到数据源名称,并且未指定默认驱动程序...

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()

{

$a=array();

$retvar=0;

$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

%windir%\System32\odbcad32.exe

to

%windir%\SysWOW64\odbcad32.exe

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/816235
推荐阅读
相关标签
  

闽ICP备14008679号