简体   繁体   English

Microsoft OLE DB Provider for SQL Server错误'80004005'

[英]Microsoft OLE DB Provider for SQL Server error '80004005'

I have migrated a classic ASP site to a new server and am getting the following error, message. 我已将经典的ASP站点迁移到新服务器,并收到以下错误消息。

I have tried different connection strings but none of them work. 我尝试了不同的连接字符串,但没有一个工作。

I am not even sure if the connection string is the problem 我甚至不确定连接字符串是否是问题

The new server is a Windows 2012 Server, SQL Server 2008 R2 Express machine. 新服务器是Windows 2012 Server,SQL Server 2008 R2 Express计算机。


Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/scripts/dbcode.asp, line 31 

Application("C2M_ConnectionString") = "Provider=SQLNCLI10;Server=(local);Database=mysite_live;Uid=mysitec_Live;Pwd=mypass;"

If it is an Express instance, it is most likely not a default instance, but rather a named instance. 如果它是Express实例,则很可能不是默认实例,而是命名实例。 So you probably meant: 所以你可能意味着:

... "Provider=SQLNCLI10;Server=.\SQLEXPRESS; ...
--- instead of just (local) ---^^^^^^^^^^^^

Otherwise you'll need to show us the server properties in SQL Server Configuration Manager on that machine in order for us to be able to tell you how to correct your connection string. 否则,您需要在该计算机上的SQL Server配置管理器中向我们显示服务器属性,以便我们能够告诉您如何更正连接字符串。

As Aaron Bertrand mentioned it would be interesting to have a look at your connection properties (In Sql Server configuration check if the following are enabled Name Pipes and TCP/Ip). 正如Aaron Bertrand所提到的,看看你的连接属性会很有趣(在Sql Server配置中检查以下是否启用了Name Pipes和TCP / Ip)。 Since you're able to connect from SSMS i would ask to check if the Remote connection is allowed on that server Also can you tell is the Sql browser service is running? 由于您可以从SSMS连接,我会要求检查该服务器上是否允许远程连接也可以告诉您Sql浏览器服务是否正在运行?

here is a link that i keep close to me as a reminder or check list on probable connection issues on SQL Server. 这是一个链接,我作为SQL Server上可能的连接问题的提醒或检查列表与我保持密切联系。 Sql Connection Issues And lastly can you try as provider "SQLNCLI" instead of "SQLNCLI10" SQL连接问题最后你可以尝试作为提供程序“SQLNCLI”而不是“SQLNCLI10”

Try pinging the server in your connection string. 尝试在连接字符串中ping服务器。 The server your application resides on should be able to communicate on the port you specify by credentials. 应用程序所在的服务器应该能够通过凭据指定的端口进行通信。 If you are developing locally try specifying "localhost". 如果您在本地开发,请尝试指定“localhost”。 If the server is clustered or you installed as an instance then you need to specify that instance. 如果服务器是群集的,或者您作为实例安装,则需要指定该实例。 Also make sure the server is configured for mixed-mode authentication if using sql credentials. 如果使用sql凭据,还要确保将服务器配置为进行混合模式身份验证。

OR Try 或者尝试

Data Source=localhost;Initial Catalog=DBNAME;Persist Security Info=True;User ID=MyUserName; Data Source = localhost; Initial Catalog = DBNAME; Persist Security Info = True; User ID = MyUserName; Password=MyPassword; 密码= myPassword;复制代码

It can be a permission issue , Please check is that server is connecting with same configuration detail from SQL management. 它可能是权限问题,请检查服务器是否从SQL管理连接相同的配置详细信息。 other is username / password is wrong. 其他是用户名/密码错误。

Here is what I would do: 这是我要做的:

EDIT: Note that this SO post , a few down, has an interesting method for creating the correct connection string to use. 编辑:请注意, 这个SO帖子 ,一些向下,有一个有趣的方法来创建正确的连接字符串使用。

  1. Open SSMS (Sql Server Management Studio) and copy/paste the username/password. 打开SSMS(Sql Server Management Studio)并复制/粘贴用户名/密码。 Don't type them, copy/paste. 不要输入,复制/粘贴。 Verify there isn't an issue. 确认没有问题。
  2. Fire up the code (this is next for me b/c this would be the next easiest thing to do in my case) and step to line 31 to verify that everything is setup properly. 启动代码(这是我的下一步b / c这将是我的下一个最容易做的事情)并逐步到第31行验证一切设置正确。 Here is some info on how to do this. 以下是有关如何执行此操作的一些信息 I understand that this may be impossible for you with this being on production so you might skip this step. 我知道,对于您来说这可能是不可能的,因此您可能会跳过此步骤。 If at all possible though, I'd set this up on my local machine and verify that there is no issue connecting locally. 如果可能的话,我会在我的本地计算机上进行设置并验证本地连接没有问题。 If I get this error locally, then I have a better chance at fixing it. 如果我在本地收到此错误,那么我有更好的机会修复它。
  3. Verify that Provider=SQLNCLI10 is installed on the production server. 验证生产服务器上是否安装了Provider = SQLNCLI10。 I would follow this SO post , probably the answer posted by gbn. 我会关注这篇SO帖子 ,可能是gbn发布的答案。
  4. You have other working websites? 你有其他工作网站? Are any of them classic asp? 他们中的任何一个经典的asp? Even if not, I'd compare the connection string in another site to the one that you are using here. 即使没有,我也会将另一个站点中的连接字符串与您在此处使用的连接字符串进行比较。 Make sure there are no obvious differences. 确保没有明显的差异。
  5. Fire up SQL Server Profiler and start tracing. 启动SQL Server Profiler并开始跟踪。 Connect to the site and cause the error then go to profiler and see if it gives you an additional error information. 连接到站点并导致错误,然后转到探查器,看看它是否为您提供了其他错误信息。
  6. If all of that fails, I would start going through this . 如果所有这些都失败了,我会开始讨论这个问题

Sorry I can't just point to something and say, there's the problem! 对不起,我不能指出一些事情说,有问题!

Good luck! 祝好运!

In line 31: 第31行:

cmd.ActiveConnection = Application("C2M_ConnectionString")

How are you instantiating cmd ? 你是如何实例化cmd

Rather than the ConnectionString being wrong, maybe cmd is acting differently in the new environment. 而不是ConnectionString是错误的,可能cmd在新环境中的表现不同。

Edited to add: 编辑添加:

I see that you've gone from IIS 7 to IIS 8. To run Classic ASP sites on IIS 7 required manual changes to server defaults, such as "allow parent paths." 我看到你已经从IIS 7迁移到IIS 8.要在IIS 7上运行经典ASP站点,需要手动更改服务器默认值,例如“允许父路径”。 Is it possible that some of the needed tweaks didn't get migrated over? 是否有可能某些必要的调整没有迁移过来?

If you're not running with Option Strict On, you should try that - it often reveals the source of subtle problems like this. 如果您没有使用Option Strict On运行,那么您应该尝试 - 它通常会揭示这样的微妙问题的根源。 (Of course, first you'll be forced to declare all your variables, which is very tedious with finished code.) (当然,首先你将被迫声明所有变量,这对于完成的代码来说非常繁琐。)

Have you ever tried SQL Server OLE DB driver connection string: 你有没有尝试过SQL Server OLE DB驱动程序连接字符串:

"Provider=sqloledb;Data Source=(local);Initial Catalog=mysite_live;User Id=mysitec_Live;Password=mypass;"

or ODBC driver: 或ODBC驱动程序:

"Driver={SQL Server};Server=SERVERNAME;Trusted_Connection=no;Database=mysite_live;Uid=mysitec_Live;Pwd=mypass;"

At least this is what I would do if nothing helps. 至少这是我在没有任何帮助的情况下会做的事情。 Maybe you will be able to get more useful error information. 也许您将能够获得更多有用的错误信息。

Could this be a x86/x64 thing? 这可能是x86 / x64吗?

The following thread seems to indicate that the (local) alias is a 32-bit alias which fails on 64-bit server: http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/c701d510-90e5-4dd0-b14f-ca1d694d6615 (note that the error is exacly what you had) 以下线程似乎表明(本地)别名是一个32位别名,它在64位服务器上失败: http//social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/c701d510- 90e5-4dd0-b14f-ca1d694d6615 (注意错误是你所拥有的)

When you were testing the .udl on the server did you test both x86 and x64? 当您在服务器上测试.udl时,您是否同时测试了x86和x64?

Following the advice from this blogpost ( http://blogs.msdn.com/b/farukcelik/archive/2007/12/31/udl-test-on-a-64-bit-machine.aspx ) you could test your local udl : 根据这篇博文( http://blogs.msdn.com/b/farukcelik/archive/2007/12/31/udl-test-on-a-64-bit-machine.aspx )的建议,您可以测试您当地的udl:

  • in 64-bit by just double clicking it (acts the same as running "C:\\Program Files\\Common Files\\System\\Ole DB\\oledb32.dll",OpenDSLFile C:\\\\test.udl 只需双击即可显示64位(与运行“C:\\ Program Files \\ Common Files \\ System \\ Ole DB \\ oledb32.dll”相同,OpenDSLFile C:\\\\ test.udl
  • in 32-bit by double running C:\\Windows\\syswow64\\rundll32.exe "C:\\Program Files (x86)\\Common Files\\System\\Ole DB\\oledb32.dll",OpenDSLFile C:\\\\test.udl 在32位通过双重运行C:\\ Windows \\ syswow64 \\ rundll32.exe“C:\\ Program Files(x86)\\ Common Files \\ System \\ Ole DB \\ oledb32.dll”,OpenDSLFile C:\\\\ test.udl

If you can confirm it's a problem with the alias I'd suggest you create a new one by following the guidelines found here: http://msdn.microsoft.com/en-us/library/ms190445(v=sql.105).aspx 如果您可以确认别名有问题,我建议您按照此处的指南创建一个新的: http//msdn.microsoft.com/en-us/library/ms190445(v = sql.105)的.aspx

Have you tried to use the server IP address instead of the "(local)"? 您是否尝试使用服务器IP地址而不是“(本地)”? Something like " Server=192.168.1.1; " (clearly you need to use the real IP address of your server) 像“ Server = 192.168.1.1; ”之类的东西(显然你需要使用服务器的真实IP地址)

In case you try to use the server IP address, check in the " SQL-Server configurator " that SQL Server is listening on the IP address you use in your connection. 如果您尝试使用服务器IP地址,请检查SQL Server正在侦听您在连接中使用的IP地址的“ SQL-Server配置程序 ”。 ( SQL Server Configurator screenshot ) SQL Server配置器截图

Other useful thing to check / try: 检查/尝试的其他有用的事情:

  • And check also if the DB is in the default SQL Server instance, or if it is in a named instance. 并检查数据库是否在默认的SQL Server实例中,或者它是否在命名实例中。
  • Do you have checked if the firewall have the TCP/IP rule for opening the port of you SQL Server? 您是否检查过防火墙是否具有用于打开SQL Server端口的TCP / IP规则?
  • Have you tried to connect to SQL Server using other software that use the TCP/IP connection ? 您是否尝试使用其他使用TCP / IP连接的软件连接到SQL Server?

The SQL Server Browser service is disabled by default on installation. 安装时默认禁用SQL Server Browser服务。 I'd recommend that you enable and start it. 我建议您启用并启动它。 For more information, see this link and the section titled "Using SQL Server Browser" for an explanation of why this might be your problem. 有关详细信息,请参阅此链接和标题为“使用SQL Server Browser”的部分,以解释为什么这可能是您的问题。

If you don't wish to enable the service, you can enable TCP/IP protocol (it's disabled by default), specify a static port number, and use 127.0.01,<port number> to identify the server. 如果您不希望启用该服务,则可以启用TCP / IP协议(默认情况下已禁用),指定静态端口号,并使用127.0.01,<端口号>来标识服务器。

Step-1: Enabling TCP/IP Protocol Start >> All Programs >> Microsoft SQL Server >> Configuration Tools >> SQL Server Configuration Manager >> SQL Server Network Configuration >> Protocols for MSSQLSERVER >> right click “TCP/IP” and select “Enable”. 步骤1:启用TCP / IP协议启动>>所有程序>> Microsoft SQL Server >>配置工具>> SQL Server配置管理器>> SQL Server网络配置>> MSSQLSERVER协议>>右键单击“TCP / IP”和选择“启用”。

Step-2: change specific machine name in Data Source attributes'value to (local) will resovle the problem ni SQL SERVER 2012. 步骤2:将数据源属性的特定机器名称更改为(本地)将重新解决问题ni SQL SERVER 2012。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP经典应用使用Azure SQL服务器时,Microsoft OLE DB Provider for ODBC Drivers错误&#39;80004005&#39; - Microsoft OLE DB Provider for ODBC Drivers error '80004005' when asp classic app use azure sql server SQL Server的Microsoft OLE DB提供程序错误&#39;80040e14&#39;无效的列名。 SQL查询 - Microsoft OLE DB Provider for SQL Server error '80040e14' Invalid column name . SQL query Microsoft OLE DB提供程序的SQL Server错误&#39;80040e07&#39; - Microsoft OLE DB Provider for SQL Server error '80040e07' SSIS OLE DB 记录可用。 来源:“Microsoft SQL Server Native Client 11.0” Hresult:0x80004005,无法确定元数据 - SSIS An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005, The metadata could not be determined 链接服务器“(null)”的 OLE DB 提供程序“Microsoft.Jet.OLEDB.4.0”报告错误 - The OLE DB provider “Microsoft.Jet.OLEDB.4.0” for linked server “(null)” reported an error 无法在 64 位 SQL Server 上加载 32 位 OLE DB 提供程序“Microsoft.ACE.OLEDB.12.0” - The 32-bit OLE DB provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server 链接服务器“(null)”的 OLE DB 提供程序“Microsoft.ACE.OLEDB.12.0”返回消息“JOIN 操作中的语法错误”。 - OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server “(null)” returned message “Syntax error in JOIN operation.” 错误:“OLE DB提供程序”MSDASQL“用于链接服务器”(null)“返回消息”[Microsoft] [ODBC驱动程序管理器]未找到数据源名称...“ - Error: “OLE DB provider ”MSDASQL“ for linked server ”(null)“ returned message ”[Microsoft][ODBC Driver Manager] Data source name not found …" 链接服务器的OLE DB提供程序报告了架构版本错误 - OLE DB provider for linked server reported a change in schema version Error 链接服务器“(null)”的OLE DB提供程序“ MSDASQL”报告错误 - The OLE DB provider “MSDASQL” for linked server “(null)” reported an error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM