为什么错误:“[ODBC Driver Manager] Data source name not found..."?(在开发环境中工作正常)

2022-01-16 00:00:00 odbc asp-classic sql-server ado

我在我的 ASP 页面中遇到问题.这是一个登录页面,它在允许访问主页之前检查用户对数据库的凭据.我创建了一个调试器页面来找出错误详细信息,这是错误消息:

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. 

这是我在登录网站时在网络服务器上遇到的错误消息.这里奇怪的是在我的机器(桌面)上本地测试页面时一切正常(即使使用 IIS 和 MSSQL 服务器).我在部署和测试页面时也使用了相同的连接字符串.

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.

谢谢,诺伊蒂

推荐答案

问题可能出在 ODBC 配置 服务器本身.换句话说,[到 ODBC 源] 的连接字符串是可以的(因为在其他服务器上测试过),但它引用了未在此特定服务器上配置的源.

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.

要解决此问题,请打开 ODBC 数据源管理器(通常是管理"工具菜单中的快捷方式之一),并检查您是否确实找到了同名的源(通常是系统 DSN")在连接字符串中.此类来源可能不存在或配置不正确.

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.

除了性能考虑之外,可以考虑在连接字符串级别使用更直接的 Data Providers(例如 MS SQL Data Provider 或 Microsoft.Jet.OLEDB);这避免了服务器上的额外配置点(ODBC 配置面板)(但这可能需要使用两个不同的连接字符串,一个用于测试环境,一个用于生产环境......)

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

相关文章