SQL Server 客户端别名不起作用

发布于 2024-12-06 00:45:07 字数 391 浏览 0 评论 0原文

旧版 vb6 应用程序使用硬编码连接字符串,例如“

Provider=SQLOLEDB.1;User ID=USER_NAME;password=USER_PASSWORD;Initial Catalog=DB_NAME;Data Source=OLD_SERVER_NAME;Network Library=DBMSSOCN

目标是将此应用程序转发到具有特定端口的 NEW_SERVER_NAME”。 我已经创建了别名,但它不起作用,应用程序继续使用旧服务器。

但是,如果删除部分 Network Library=DBMSSOCN (我在测试应用程序中做到了) 一切正常。

有没有机会让它与原始连接字符串一起工作?

The legacy vb6 application uses hardcoded connection strings like

Provider=SQLOLEDB.1;User ID=USER_NAME;password=USER_PASSWORD;Initial Catalog=DB_NAME;Data Source=OLD_SERVER_NAME;Network Library=DBMSSOCN

The goal is to forward this application to the NEW_SERVER_NAME with specific port.
I've created alias but it is not working, application continues to use old server.

However if remove part Network Library=DBMSSOCN (I did it in test application)
everything works fine.

Is there any chance to make it work with original connection string?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╰沐子 2024-12-13 00:45:07

DBMSSOCN 指用于连接的网络库。在本例中为 TCP/IP。可以为命名管道、TCP/IP 和 VIA 配置别名。当您删除 DBMSSOCN 设置时,它会回退到命名管道而不是 TCP/IP。确保两件事(均在 SQL Server 配置管理器中的 32 位和 64 位 SQL Native Client 配置部分):

  • 在“客户端协议”下,确保启用 TCP/IP。

Client Protocols

  • 在别名下,确保您创建的别名适用于连接字符串指定的特定网络库。就您而言,是 TCP/IP。

Alias - New Window

您可能需要在应用程序服务器上安装 SQL Native Client 10.0 并更改连接字符串才能使用它在此之前的客户端版本将起作用。要安装新客户端,您需要安装SQL Server Tools 来自 SQL Server 2008 安装。新的连接字符串可能如下所示(示例是来自 ConnectionStrings.com):

Provider=SQLNCLI10;Server=ServerAlias;Database=myDataBase;Uid=myUsername;Pwd=myPassword

DBMSSOCN refers to the network library used for the connection. In this case, TCP/IP. Aliases can be configured for Named Pipes, TCP/IP, and VIA. When you remove the DBMSSOCN setting, it falls back to Named Pipes instead of TCP/IP. Make sure of two things (both in SQL Server Configuration Manager under the 32-bit and 64-bit SQL Native Client Configuration sections):

  • Under Client Protocols, ensure TCP/IP is enabled.

Client Protocols

  • Under Aliases, make sure the alias you create is for the specific network library your connection string specifies. In your case, TCP/IP.

Alias - New Window

You may need to install the SQL Native Client 10.0 on the application server and change the connection string to use that version of the client before this will work. To install the new client, you'll need to install the SQL Server Tools from the installation of SQL Server 2008. The new connection string may look like the following (example is standard security from ConnectionStrings.com):

Provider=SQLNCLI10;Server=ServerAlias;Database=myDataBase;Uid=myUsername;Pwd=myPassword
愚人国度 2024-12-13 00:45:07

cliconfg.exe 可用于在 64b 计算机上运行时配置客户端别名,仅为 64b 程序创建条目;如果您没有 sql 工具并且想要为 32 和 64b 程序创建别名,请在注册表中创建以下条目(下面是带有 TCP 别名的 reg 文件的内容):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo]
"oldserver\\oldinstance"="DBMSSOCN,newserver\\newinstance"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo]
"oldserver\\oldinstance"="DBMSSOCN,newserver\\newinstance"

cliconfg.exe which can be used to configure client alias when run on 64b machine only creates entry for 64b programs; if you don't have sql tools and want to create alias for both 32 and 64b programs create following entries in registry (below are contents of reg file with TCP alias):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo]
"oldserver\\oldinstance"="DBMSSOCN,newserver\\newinstance"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo]
"oldserver\\oldinstance"="DBMSSOCN,newserver\\newinstance"
一个人的夜不怕黑 2024-12-13 00:45:07

默认 TCP/IP 端口是 1433,但这是可配置的。这是一个逐步的步骤(希望)至少可以解决您所面临的问题的一部分。
http://msdn.microsoft.com/en-us/library/ms177440.aspx

至于您的别名,您可以确保您是在客户端而不是 sql-server 上创建的。 (并不是说你做错了什么,但我有时会看到这个错误......)
http://support.microsoft.com/kb/289573

The default TCP/IP port is 1433, but that's configurable. Here's a step-by-step that (hopefully) addresses at least that part of the problem you're facing.
http://msdn.microsoft.com/en-us/library/ms177440.aspx

As for your alias, you might make sure that you created it on the client, not sql-server. (Not saying you did anything wrong, but I see that mistake sometimes...)
http://support.microsoft.com/kb/289573

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文