JT400-IBMi机器拒绝了JDBC连接,但在Windows机器上可以使用 [英] JT400 - JDBC connection refused from IBMi machine but working from Windows machine
问题描述
JT400-从Windows机器连接到IBMi机器时,JDBC连接工作正常.
JT400 - The JDBC connection is working fine when connecting to a IBMi machine from windows machine.
DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
String sysname = "xxx.xxx.xx.xxx";
String xref = "IBMISQLLIB";
String url = "jdbc:as400://" + sysname + ";translate binary=true;prompt=false;naming=sql;libraries=" + xref;
Connection connection = DriverManager.getConnection(url, "USERNAME", "PASSWORD");
print("Connection created successfully");
但是无法使用相同的代码创建连接-在同一台IBMi机器上运行代码时(通过"QSH Command Entry"上的可运行jar),错误:
But fails to create the connection by using the same code - when running the code on the same IBMi machine (by a runnable jar on 'QSH Command Entry'), ERROR:
java.sql.SQLException:应用程序请求者无法建立联系.(远程主机拒绝了尝试的连接操作.(连接被拒绝))com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:887)在com.ibm.as400.access.JDError.throwSQLException(JDError.java:610)在com.ibm.as400.access.JDError.throwSQLException(JDError.java:568)在com.ibm.as400.access.AS400JDBCConnectionImpl.setProperties(AS400JDBCConnectionImpl.java:3522)在com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1430)位于com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1280)在com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:403)在java.sql.DriverManager.getConnection(DriverManager.java:675)在java.sql.DriverManager.getConnection(DriverManager.java:258)
java.sql.SQLException: The application requester cannot establish the connection. (A remote host refused an attempted connect operation. (Connection refused)) at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:887) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:610) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:568) at com.ibm.as400.access.AS400JDBCConnectionImpl.setProperties(AS400JDBCConnectionImpl.java:3522) at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1430) at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1280) at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:403) at java.sql.DriverManager.getConnection(DriverManager.java:675) at java.sql.DriverManager.getConnection(DriverManager.java:258)
任何想法现在出了什么问题吗?
Any idea what is going wrong now ??
- 因为这在几天前就起作用了
- 相同的代码正在其他IBMi服务器上工作
有关IBMi机器的更多详细信息是:
Some more details about the IBMi machine are:
- 连接配置文件中使用的用户名没有访问权限问题
- 在IBMi机器上未设置防火墙
- 按照说明验证TCP/IP配置-
推荐答案
问题与默认的TCP/IP端口有关,该端口未监听JDBC连接请求.
The problem was related to default TCP/IP port, which was not listening the JDBC connection request.
最后,通过重新启动IBMi机器解决了问题.
And finally the problem got resolved by restarting the IBMi machine.
:)
这篇关于JT400-IBMi机器拒绝了JDBC连接,但在Windows机器上可以使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!