Why Error: “[ODBC Driver Manager] Data source name

2020-02-06 03:58发布

I'm encountering problems in my ASP page. This is a login page which checks the user's credentials to the database before it allows access to the main page. I created a debugger page to find out what's the error details and this is the error message:

 Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. 

That's the error message I' m encountering on the web server when I'm loging in to the site. The weird thing here is when testing the page locally on my machine (desktop) everything works fine (even with IIS and MSSQL server). I'm also using the same connection string when deploying and testing the page.

Please help, any suggestions or comments will be greatly accepted.

Thanks, Nhoyti

6条回答
Deceive 欺骗
2楼-- · 2020-02-06 04:02

Last year I had this error when trying to connect to MySQL server. Try delete from Your my.ini one line: "skip-name-resolve" (disable name resolving), that don't resolve hostnames, because in this case all hostnames are IP or 'localhost'. OR try change edit yout 'account'@'localhost' to 'account'@'127.0.0.1'

查看更多
男人必须洒脱
3楼-- · 2020-02-06 04:08

A typical ODBC connection string to connect to SQL Server might look like this.

DRIVER={SQL Server};SERVER=127.0.0.1\SQLEXPRESS;DATABASE=dbname;
UID=userid;PWD=password

Go to Control Panel -> Administrave Tools -> Data Sources (ODBC)

Try create a user DSN using the information provided in your connection string and test the ODBC connection from your production server to the SQL Server.

查看更多
男人必须洒脱
4楼-- · 2020-02-06 04:10

I had a similar but slightly different issue and solution.

I was using Excel 64-bit and needed the 64-bit driver, instead.

In my case, was using a System.Runtime.InteropServices method via C# routine I developed awhile back when using Excel 32-bit -- the routine auto defines a set of ODBC connections at runtime (where was only installing the 32-bit My ODBC driver). The routine opens and edits an Excel spreadsheet (as a template -- then renames it on closing); while open it resets a series of connections, using this driver, for the current target names of DBs the user selected -- the MySQL DBs drive a bunch of pivot tables used for analysis.

I installed a latest version for My ODBC (where I could find both versions (5.3.13)).
With the 64-bit driver installed, no changes needed and the routine started working again. Also tested that can have both versions installed and works on 64-bit OS using either 32-bit or 64-bit MS Excel license.

Thanks for the help on this. I'd be nowhere today without stackoverflow!!.

查看更多
在下西门庆
5楼-- · 2020-02-06 04:11

The problem is probably with the ODBC configuration on the Server itself. In other words the connection string [to the ODBC source] is ok (since tested on other server), but it makes reference to a source that is not configured on this particular server.

To remedy the problem, open the ODBC Data Source Administrator (typically one of the shortcuts in the "Administrative" tools menu), and check if indeed you have a source (typically a "System DSN") with the same name found in the connection string. Such Source is probably inexistant or improperly configured.

Aside from performance considerations, one may consider using more direct Data Providers (such as MS SQL Data Provider or Microsoft.Jet.OLEDB) at the level of the connection string; this avoids the extra configuration point (the ODBC config panel) on the server (but then this may require using two distinct connections strings, one for the test environment and one for the production environment...)

查看更多
一夜七次
6楼-- · 2020-02-06 04:11

Note that installing version sqlcmd 15.0.1000.34 requires both of these to be installed:

  • ODBC 13
  • ODBC 17

It will complain during installation and at run time and the error messages may not reflect reality.

Thread @ social.technet.microsoft.com

Bug @ feedback.azure.com

查看更多
Luminary・发光体
7楼-- · 2020-02-06 04:23

I ran into the same problem (while trying to connect to MySQL through Excel VBA) and it took me nearly half a day to resolve. I finally resolved the issue due to a response from fr0mi on VBForums.

fr0mi's answer on VBForums

I am running Windows 7 64 Bit system and thus downloaded all the ODBC Connectors for the 64 Bit system. However using this I was unable to connect Excel to the MySQL Database & I was unable to run a macro that would connect to the Database. Yet, on Administrator Tools the ODBC Driver always created a successful connection to the database - so I thought the MySQL ODBC 5.1 Driver would be fine to use.

However it seems on a 64 Bit system you have two Connectors one 32 Bit and one 64 Bit. The file "odbcad32.exe" lies in "C:\Windows\SysWOW64\" - You will realise that there is no MySQL ODBC Driver listed. Now, to basically fix all this you have to also download the ODBC Connector 32Bit and install it. Then configure the driver to your Database. You will realise that the driver will not be a 5.1 instead 3.51 - Which you will need to change in your VBA script as well. Then it should work.

查看更多
登录 后发表回答