当我尝试通过我的服务器从我的客户端连接我的数据库时出现以下错误

当我尝试通过我的服务器从我的客户端连接我的数据库时出现以下错误

本文介绍了当我尝试通过我的服务器从我的客户端连接我的数据库时出现以下错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在同一台机器上运行客户端和服务器。 我制作了一个虚拟程序,其中简单的服务器和客户端通过TCP客户端类连接。 DB包含一个具有两个字段name和ID的表。在服务器端,数据库连接成功,但在客户端,当我输入名称和ID并按下按钮保存此错误发生: 建立与SQL Server的连接时发生网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供商:TCP提供商,错误:0-连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应。) 解决方案 如果您确定您的连接字符串是正确的,请确保您还要: 1.在SQL Server中启用远程连接,并且 2.启用TCP / IP到SQL Server的通信,以及 3.在端口1433上允许传入连接服务器防火墙 这是一个很好的指南 http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable -remote-connections-in-sql-server-2008.aspx [ ^ ] 它是为SQL Server 2008编写的,但它与SQL Server 2012一样好用和2014年。 I am running client and server on same machine.i have made a dummy program in which simply server and client are connected through TCP client classes. DB contains one table having two fields "name" and "ID". On server side the db connects successfully but on client side when i enter name and ID and press button Save this error occur :A network related or instance- specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (Provider: TCP provider, error: 0- A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) 解决方案 If you're sure that your connection string is correct, make sure that you've also:1. Enabled remote connections in SQL Server, and2. Enabled communication of TCP/IP to SQL Server, and3. Allowed incoming connections on port 1433 on the servers firewallThere's a good guide to this at http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx[^]It's written for SQL Server 2008 but it works just as well with SQL Server 2012 and 2014 as well. 这篇关于当我尝试通过我的服务器从我的客户端连接我的数据库时出现以下错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 21:24