[英]Configuring SQL Native Client ODBC on the client computer?
We have an application where our clients are connecting to a SQL Server 2005 database - via a SQL Native Client ODBC data source. 我们有一个应用程序,我们的客户端通过SQL Native Client ODBC数据源连接到SQL Server 2005数据库。 We are having some difficulties with the ODBC connection getting severed during program execution. 在程序执行期间,ODBC连接被切断了,我们遇到了一些困难。 After questioning a tech support person, he said that he had seen this type of error before, but they fixed the issue by configuring the clients to connect using Named Pipes (primarily), rather than TCP/IP. 在询问了技术支持人员之后,他说他之前见过这种类型的错误,但他们通过配置客户端使用命名管道(主要是)而不是TCP / IP进行连接来解决问题。
So I did some research and found where to configure client access on the server - via the SQL Server Configuration Manager. 所以我做了一些研究,发现在服务器上配置客户端访问的位置 - 通过SQL Server配置管理器。 However, there does not appear to be a way to configure the SQL Native Client ODBC data source on the client machine itself. 但是,似乎没有办法在客户端计算机本身上配置SQL Native Client ODBC数据源。 The older SQL Server ODBC driver did allow you to configure it to use Named Pipes, or TCP/IP, but the SQL Native Client does not. 较旧的SQL Server ODBC驱动程序允许您将其配置为使用命名管道或TCP / IP,但SQL Native Client不允许。
Does the SQL Native Client data source automatically decided which method to use to connect to the database? SQL Native Client数据源是否自动决定使用哪种方法连接到数据库? Is there a way to configure it?…and is there a way to find out which method a particular client machine is using to connect? 有没有办法配置它?...有没有办法找出特定客户端机器用于连接的方法?
Any help would be appreciated. 任何帮助,将不胜感激。
--Thanks Mike C. - 谢谢Mike C.
Note you can set the protocol used in the connection string, there is no need to configure the machine. 注意您可以设置连接字符串中使用的协议,不需要配置机器。 I would recommend NOT changing the machine configuration using cliconfg, since this impacts all applications running on the machine. 我建议不要使用cliconfg更改机器配置,因为这会影响机器上运行的所有应用程序。
So there are 2 ways to set the network protocol. 因此,有两种方法可以设置网络协议。
Use the protocol prefix: 使用协议前缀:
Server=tcp:myserver
Server=np:myserver
tcp:
prefix means use tcp protocol. tcp:
prefix表示使用tcp协议。 np:
prefix means use named pipes protocol. np:
prefix表示使用命名管道协议。 Just stick this in front of the server name you are connecting to. 只需将其粘贴在您要连接的服务器名称前面即可。
Second ways is to set the Network keyword in the connection string: 第二种方法是在连接字符串中设置Network关键字:
Network=dbmssocn
Network=dbnmpntw
I prefer the protocol prefix because I can never remember these network type abbreviations. 我更喜欢协议前缀,因为我永远不会记住这些网络类型的缩写。
Maybe this will get you going: 也许这会让你前进:
4) If you are using SQL Native Client ODBC/OLEDB provider({SQL Native Client} or SQLNCLI), go to SQL Configuration Manager, click client protocols, make sure NP and TCP are both enabled. 4)如果您使用的是SQL Native Client ODBC / OLEDB提供程序({SQL Native Client}或SQLNCLI),请转到SQL Configuration Manager,单击客户端协议,确保已启用NP和TCP。 Right click properties of NP, make sure client is using the same pipe name as server for connection. 右键单击NP的属性,确保客户端使用与服务器相同的管道名称进行连接。
The node is actually 'SQL Native Client Configuration', You can change priority and disable from there. 该节点实际上是“SQL Native Client Configuration”,您可以从那里更改优先级并禁用。
from http://blogs.msdn.com/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx 来自http://blogs.msdn.com/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx
Not sure about Named Pipes being any sort of an answer for ODBC connection breaking. 不确定命名管道是ODBC连接中断的任何答案。 Without first identifying the source of the problem, I wouldn't count on named pipes. 在没有首先确定问题的根源的情况下,我不会指望命名管道。 I might be wrong though. 我可能错了。 Can you see any error that may explain this problem? 你能看到任何可以解释这个问题的错误吗? This may be network related. 这可能与网络有关。
Otherwise, I think it should be quite easy to configure this on the client machine: just run cliconfg (SQL Server Client Network Utility). 否则,我认为在客户端计算机上配置它应该很容易:只需运行cliconfg(SQL Server客户端网络实用程序)。 in the General tab make sure the Named Pipes protocol is enabled, then navigate to the Alias tab and simply create an alias for your server using Named Pipes. 在“常规”选项卡中,确保已启用“命名管道”协议,然后导航到“别名”选项卡,只需使用“命名管道”为服务器创建别名。
Good luck. 祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.