从Java登录到MSSQL服务器时出现问题 [英] Problems logging into MSSQL server from Java
问题描述
我正在尝试连接到本地主机上的MSSQL Server 2008,但出现错误
I am trying to connect to MSSQL server 2008 on my localhost, but I am getting Errors
警告:ConnectionID:2预登录错误:主机127.0.0.1端口1434读取预登录响应时出错:连接重置
WARNING: ConnectionID:2 Prelogin error: host 127.0.0.1 port 1434 Error reading prelogin response: Connection reset
此错误非常迅速地重复了20次,然后我得到了 com.microsoft.sqlserver.jdbc.SQLServerException:连接重置
this error repeats like 20 times very quickly, then i get com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
我怀疑这是服务器的某些错误配置.我可以毫无问题地连接到外部服务器.我也可以通过Management Studio毫无问题地进行连接.
I suspect this is some wrong configuration of server. I can connect to external servers with no issues. I can also connect via management studio with no problems.
请帮助我,我已经厌倦了这个问题:|
Please help me, I am getting sick of this issue :|
推荐答案
1)默认情况下,禁用用于MSSQL 2008的TCP协议.您需要从SQL Configuration Manager(与MSSQL相同的[Start],Programs文件夹中)启用它:
1) TCP protocol for MSSQL 2008 is disabled by default. You need to enable it from SQL Configuration Manager (in the same [Start], Programs folder as MSSQL):
2)要使用TCP连接(甚至在本地主机上也要使用!),您需要在Windows防火墙中允许MSSQL:
2) To use TCP connections (even on localhost!) you need to allow MSSQL in Windows Firewall:
3)您不一定要使用TCP/IP来访问MSSQL:
3) You don't necessarily need to use TCP/IP in order to access MSSQL:
'希望有帮助!
这篇关于从Java登录到MSSQL服务器时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!