MSSQL异常:JDBC连接SqlServer2000出现"Connection refused: connect"解决方案
2009-05-28 22:18
911 查看
For this kind of database connection problem, there are always two distinct issues:
The SQL server itself is not running or TCP/IP is disabled. That can be confirmed by runnetstat
and see it is listed there. And then run
telnet localhost 1433
and see it can connect (or whatever port number).
Even if the server is running, a client program such like jdbc may still fail to connect to it because of afirewall
For testing, you can turn off the XP firewall. And if you have other firewall running, check the firewall log and see any activities that might be related.
You can also verify whether or not your server is running from the
SQL Server Network Utilityon the server, or from another client utility such as
SQL Query Analyzer
or a command line utility such as
osql
To check the enabled protocols for a server, follow these steps:
In SQL Server 2000, start the SQL Server Network Utility (svrnetcn.exe).
On the General tab, select the instance of Microsoft SQL Server on which to load an installed server network library.
Make sure that TCP/IP appears in the Enabled Protocols list.
To find the port number, in the Enabled Protocols list, click TCP/IP, and then click Properties. The Properties dialog box displays the port number.
There is an known bug: SQL Server May Not Listen on TCP/IP Sockets When TCP/IP is the Only Protocol
In a SQL Server 2000 custom installation, if TCP/IP is the only selected protocol and all other protocols are disabled, SQL Server may not initialize and listen on TCP/IP sockets. The Server Network Utility shows that it is listening only on TCP/IP port 1433 even though it is not. To identify if SQL Server is not listening on TCP/IP, check to see if the value for TcpPort in the following registry key is incorrectly set to blank or empty:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL Server/ [Instance Name]/MSSQLServer/SuperSocketNetLib/Tcp/REG_SZ TcpPort=
To work around this problem, follow these steps:
Start Registry Editor (Regedt32.exe).
Locate the TcpPort value in the following key in the registry:Named instance:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL Server/[InstanceName]/MSSQLServer/SuperSocketNetLib/Tcp/TcpPort
Default instance:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSSQLServer
/MSSQLServer/SuperSocketNetLib/TCP/TcpPort
. On the Edit menu, click String. Enter either of the following values:
a. Type the port number you want. -or-
b. Enter a value of 0 to have SQL Server dynamically detect and assign a port the next time SQL Server starts.
Click OK.
Quit Registry Editor.
SQL Server 2000 Service Pack 4 (SP4):
You are running a version of Microsoft SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine (also called MSDE) that has known security vulnerabilities when used in conjunction with the Microsoft Windows Server 2003 family. To reduce your computer’s vulnerability to certain virus attacks, the TCP/IP and UDP network ports of Microsoft SQL Server 2000, MSDE, or both have been disabled. To enable these ports, you must install SQL Server 2000 Service Pack 3a, or the most recent service pack for Microsoft SQL Server 2000 or MSDE from http://www.microsoft.com/sql/downloads/2000/sp4.mspx.
The SQL server itself is not running or TCP/IP is disabled. That can be confirmed by runnetstat
and see it is listed there. And then run
telnet localhost 1433
and see it can connect (or whatever port number).
Even if the server is running, a client program such like jdbc may still fail to connect to it because of afirewall
For testing, you can turn off the XP firewall. And if you have other firewall running, check the firewall log and see any activities that might be related.
You can also verify whether or not your server is running from the
SQL Server Network Utilityon the server, or from another client utility such as
SQL Query Analyzer
or a command line utility such as
osql
To check the enabled protocols for a server, follow these steps:
In SQL Server 2000, start the SQL Server Network Utility (svrnetcn.exe).
On the General tab, select the instance of Microsoft SQL Server on which to load an installed server network library.
Make sure that TCP/IP appears in the Enabled Protocols list.
To find the port number, in the Enabled Protocols list, click TCP/IP, and then click Properties. The Properties dialog box displays the port number.
There is an known bug: SQL Server May Not Listen on TCP/IP Sockets When TCP/IP is the Only Protocol
In a SQL Server 2000 custom installation, if TCP/IP is the only selected protocol and all other protocols are disabled, SQL Server may not initialize and listen on TCP/IP sockets. The Server Network Utility shows that it is listening only on TCP/IP port 1433 even though it is not. To identify if SQL Server is not listening on TCP/IP, check to see if the value for TcpPort in the following registry key is incorrectly set to blank or empty:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL Server/ [Instance Name]/MSSQLServer/SuperSocketNetLib/Tcp/REG_SZ TcpPort=
To work around this problem, follow these steps:
Start Registry Editor (Regedt32.exe).
Locate the TcpPort value in the following key in the registry:Named instance:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SQL Server/[InstanceName]/MSSQLServer/SuperSocketNetLib/Tcp/TcpPort
Default instance:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSSQLServer
/MSSQLServer/SuperSocketNetLib/TCP/TcpPort
. On the Edit menu, click String. Enter either of the following values:
a. Type the port number you want. -or-
b. Enter a value of 0 to have SQL Server dynamically detect and assign a port the next time SQL Server starts.
Click OK.
Quit Registry Editor.
SQL Server 2000 Service Pack 4 (SP4):
You are running a version of Microsoft SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine (also called MSDE) that has known security vulnerabilities when used in conjunction with the Microsoft Windows Server 2003 family. To reduce your computer’s vulnerability to certain virus attacks, the TCP/IP and UDP network ports of Microsoft SQL Server 2000, MSDE, or both have been disabled. To enable these ports, you must install SQL Server 2000 Service Pack 3a, or the most recent service pack for Microsoft SQL Server 2000 or MSDE from http://www.microsoft.com/sql/downloads/2000/sp4.mspx.
相关文章推荐
- MSSQL异常:JDBC连接SqlServer2000出现"Connection refused: connect"解决方案
- JDBC连接SqlServer2000出现"Connection refused: connect"的解决方案
- mysql front v5.1 现在连接时出现异常“程序注册时间到期了,程序将被限制"解决方案
- IDA Pro调试出现"Could not connect to 127.0.0.1: 由于目标计算机积极拒绝,无法连接。"的解决方案
- JDBC连接SQL Server 2005出现Connection refused:connect
- 亚马逊的PuTTY连接AWS出现network error connection refused,终极解决方案。
- ssh连接树莓派出现"network error:connection refused"的解决办法
- vs .net 2005 打开VSS项目时出现:"could not find the visual sourcesafe internet web service connection"的解决方案
- jtds"Network error IOException Connection refused: connect"问题解决
- 现在的连接url:Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnico
- SqlServer连接异常java.sql.SQLException: Network error IOException: Connection refused: connect
- JDBC连接SQL Server出现的connection refused问题的解决办法
- 解决连接MySQL时出现securityException异常,并且会有"That assembly does not allow partially trusted callers"的异常信息
- sqlserver2008 jDBC 连接报错:Connection refused: connect
- Xlib: connection to ":0.0" refused by server 解决方案
- 浮点库的连接问题(针对有的时候scanf("%f",&fn);出现的异常)
- com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection refused: connect
- SSH连接GitHub出现 ssh: connect to host github.com port 22: Connection refused解决方法
- JDBC 连接SQL Server:Connection refused: connect
- om.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection refused: connect