我有一个连接到MS数据库的java程序。该程序在运行eclipse时完美地运行了,但是当我在AIX中运行它时会出现一个错误:
java.sql.SQLException:网络错误IOException:远程主机拒绝尝试连接操作。
我可以成功地平平服务器,但无法将网络传输到服务器。我也无法从我的windows桌面上进行远程访问。
我使用jtds连接:
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关于这个问题的一些文档,但我仍然无法解决这个问题。
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.
发布于 2011-08-10 08:41:39
您的Server数据库可能没有启用TCP/IP协议来启用它:
从Microsoft 2005配置工具中打开“Microsoft配置Manager'.
对于Server 2008:
发布于 2011-08-10 08:34:51
如果您无法在端口1433上进行远程访问,您就会被防火墙阻塞,防火墙位于您的计算机和服务器之间的某个位置。这不是一个与java相关的问题。
当您说“它在eclipse下完美地运行,而不是AIX”时,您会使用大约2台不同的计算机吗?如果是这样的话,带eclipse的那个不是防火墙,你部署应用程序的那个就被屏蔽了。
但是,与java无关。这是TCP-IP模型的第三级错误(TCP层).
你好,Stéphane
https://stackoverflow.com/questions/7014312
复制相似问题