首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >通过telnet连接到外部数据库

通过telnet连接到外部数据库
EN

Stack Overflow用户
提问于 2011-08-10 16:24:15
回答 2查看 3K关注 0票数 0

我有一个连接到MS数据库的java程序。该程序在运行eclipse时完美地运行了,但是当我在AIX中运行它时会出现一个错误:

java.sql.SQLException:网络错误IOException:远程主机拒绝尝试连接操作。

我可以成功地平平服务器,但无法将网络传输到服务器。我也无法从我的windows桌面上进行远程访问。

我使用jtds连接:

代码语言:javascript
运行
复制
String connectionString = "jdbc:jtds:sqlserver://"+dropez_ip_address+"/"+dropez_db_name;
ResultSet rs = null;
Statement stmt = null;

try{

    Class.forName("net.sourceforge.jtds.jdbc.Driver");
    Connection conn = DriverManager.getConnection(connectionString, dropez_db_username, dropez_db_password);

    stmt = conn.createStatement();
}catch(Exception e){}

以下是jTDS关于这个问题的一些文档,但我仍然无法解决这个问题。

代码语言:javascript
运行
复制
Why do I get java.sql.SQLException: "Network error IOException: Connection refused: connect" when trying to get a connection?

The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:

    - The server name is misspelled or the port number is incorrect.
    - SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
    - There is a firewall blocking port 1433 on the server.

To check whether TCP/IP is enabled and the port is not blocked you can use "telnet 1433". Until telnet doesn't connect, jTDS won't either. If you can't figure out why, ask your network administrator for help.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-08-10 16:41:39

您的Server数据库可能没有启用TCP/IP协议来启用它:

从Microsoft 2005配置工具中打开“Microsoft配置Manager'.

  • Expand‘Server 2005网络配置”,然后单击“
  1. ”。
  2. 右键单击“TCP/IP”,然后单击“启用”。该协议的图标将更改以显示该协议已启用。

对于Server 2008:

票数 0
EN

Stack Overflow用户

发布于 2011-08-10 16:34:51

如果您无法在端口1433上进行远程访问,您就会被防火墙阻塞,防火墙位于您的计算机和服务器之间的某个位置。这不是一个与java相关的问题。

当您说“它在eclipse下完美地运行,而不是AIX”时,您会使用大约2台不同的计算机吗?如果是这样的话,带eclipse的那个不是防火墙,你部署应用程序的那个就被屏蔽了。

但是,与java无关。这是TCP-IP模型的第三级错误(TCP层).

你好,Stéphane

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7014312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档