首页 > 数据库

MSSQL异常:JDBC连接SqlServer2000出现"Connection refused: connect"解决方案

时间:2009-05-29 15:19:52  作者:叶现一  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
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 ca......

For this kind of database connection problem, there are always two distinct issues:

  1. 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).

  2. 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:

  1. In SQL Server 2000, start the SQL Server Network Utility (svrnetcn.exe).
  2. On the General tab, select the instance of Microsoft SQL Server on which to load an installed server network library.
  3. Make sure that TCP/IP appears in the Enabled Protocols list.
  4. 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:

  1. Start Registry Editor (Regedt32.exe).
  2. 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

如果您需转载 MSSQL异常:JDBC连接SqlServer2000出现"Connection refused: connect"解决方案,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门