问题描述
尝试使用安全网关将bluemix应用程序(java自由配置文件)连接到我们的内部部署数据库/ as400。拒绝或允许所有连接,不会更改错误消息。似乎应用程序的请求没有到达安全网关客户端(我没有看到sgw客户端上提到的连接被拒绝的消息)。我可以解决吗这个代码:
DB_SERVERNAME = jdbc:as400://xxx-xx-xxx-x.integration.ibmcloud.com: 15XXX / dbname
try {
Driver driver = new com.ibm.as400.access.AS400JDBCDriver();
DriverManager.registerDriver(driver);
System.out.println(Driver Loaded Successfully ...);
dbConn = DriverManager.getConnection(DB_SERVERNAME,DB_USERNAME,DB_PASSWORD);
System.out.println(Connected ...);
} catch(SQLException e){
e.printStackTrace();
}
错误msg是:
驱动程序已成功加载...
ERR App [err] java.sql.SQLException:应用程序请求者无法建立连接。 (拒绝连接)
在com.ibm.as400.access.JDError.throwSQLException(JDError.java:565)
ERR应用程序[err]在com.ibm.as400.access的应用程序[err]。 AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3308)
ERR应用程序在com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1393)上的应用程序
ERR应用程序[err] at com。 ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1230)
ERR应用程序com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:371)上的[err]
ERR应用程序java.sql.DriverManager.getConnection(未知源)的错误
在java.sql.DriverManager.getConnection(未知来源)中的错误应用程序
wasdev.sample中的应用程序[err]。 servlet.DBServlet.getDBConnection(DBServlet.java:106)
在wasdev.sample.servlet.DBServlet.doGet(DBServlet.java:64)
ERR应用程序[err]在javax。 servlet.http.HttpServlet.service(HttpServlet.java:687)
ERR应用程序javax.servlet.http.HttpServlet.ser上的[err] (HttpServlet.java:790)
ERR应用程序[err] at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
ERR应用程序[err] at [internal类]
ERR应用程序java.util.concurrent.ThreadPoolExecutor.runWorker(未知源)的应用程序
ERR应用程序java.util.concurrent.ThreadPoolExecutor上的[err] $ Worker.run(未知来源)
ERR java.lang.Thread.run(未知来源)的应用程序错误
ERR应用程序[err]导致:
ERR应用程序[err] java.net.ConnectException:连接被拒绝
ERR应用程序java.net.AbstractPlainSocketImpl.doConnect(未知源)上的应用程序
ERR应用程序java.net.AbstractPlainSocketImpl.connectToAddress(未知源)上的[err]
ERR App [err ]在java.net.AbstractPlainSocketImpl.connect(未知来源)
ERR应用程序java.net.SocksSocketImpl.connect(未知源)上的[err]
ERR应用程序java.net.Socket上的[err]。连接(未知来源)
ERR应用程序[err] at sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
ERR应用程序[err] at sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)
ERR应用程序[err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)
ERR应用程序[err]在java.lang。反映.Method.invoke(未知源)
应用程序[err]在com.ibm.as400.access.PortMapper.getSocketConnection(PortMapper.java:273)
ERR应用程序[err]在com.ibm。 as400.access.PortMapper.getServerSocket(PortMapper.java:161)
ERR app [err] at com.ibm.as400.access.AS400ImplRemote.signonConnect(AS400ImplRemote.java:2334)
ERR App [err ] at com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:2250)
ERR app [err] at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:3035)
ERR app [err] at com.ibm.as400.access.AS400.signon(AS400.java:3910)
ERR app [err] at com.ibm.as400.access.AS400.connectService(AS400。 java:1168)
ERR app [err] at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3300)
ERR App [err] ... 32更多
JT400 JDBC驱动程序与IBM i系统进行通信各自运行的港口。您将需要通过您的安全网关转发所有这些端口,以使其正常工作。有关更多信息,请参见文档(您需要as-数据库,中央和至少登录)。
如果您需要更改应用程序使用的端口进行连接,则可以通过创建一个AS400对象,并使用来更改默认端口。然后通过AS400对象进行连接,而不是使用系统,用户名和密码。
trying to connect a bluemix app (java liberty profile) to our on-premise db/as400 using a secure gateway. Denying or allowing all connection, doesn't change the error message. It seems that the request from the app doesn't reach the secure gateway client (and I don't see messages on sgw client that mentions the connection refused).
How can i resolve that? This the code:
DB_SERVERNAME=jdbc:as400://xxx-xx-xxx-x.integration.ibmcloud.com:15XXX/dbname
try {
Driver driver = new com.ibm.as400.access.AS400JDBCDriver();
DriverManager.registerDriver(driver);
System.out.println("Driver Loaded Successfully ...");
dbConn = DriverManager.getConnection(DB_SERVERNAME, DB_USERNAME, DB_PASSWORD);
System.out.println("Connected...");
} catch (SQLException e) {
e.printStackTrace();
}
And the error msg is :
Driver Loaded Successfully ...
ERR App [err] java.sql.SQLException: The application requester cannot establish the connection. (Connection refused)
ERR App [err] at com.ibm.as400.access.JDError.throwSQLException(JDError.java:565)
ERR App [err] at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3308)
ERR App [err] at com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:1393)
ERR App [err] at com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDriver.java:1230)
ERR App [err] at com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:371)
ERR App [err] at java.sql.DriverManager.getConnection(Unknown Source)
ERR App [err] at java.sql.DriverManager.getConnection(Unknown Source)
ERR App [err] at wasdev.sample.servlet.DBServlet.getDBConnection(DBServlet.java:106)
ERR App [err] at wasdev.sample.servlet.DBServlet.doGet(DBServlet.java:64)
ERR App [err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
ERR App [err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
ERR App [err] at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
ERR App [err] at [internal classes]
ERR App [err] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
ERR App [err] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
ERR App [err] at java.lang.Thread.run(Unknown Source)
ERR App [err] Caused by:
ERR App [err] java.net.ConnectException: Connection refused
ERR App [err] at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
ERR App [err] at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
ERR App [err] at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
ERR App [err] at java.net.SocksSocketImpl.connect(Unknown Source)
ERR App [err] at java.net.Socket.connect(Unknown Source)
ERR App [err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
ERR App [err] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
ERR App [err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
ERR App [err] at java.lang.reflect.Method.invoke(Unknown Source)
App [err] at com.ibm.as400.access.PortMapper.getSocketConnection(PortMapper.java:273)
ERR App [err] at com.ibm.as400.access.PortMapper.getServerSocket(PortMapper.java:161)
ERR App [err] at com.ibm.as400.access.AS400ImplRemote.signonConnect(AS400ImplRemote.java:2334)
ERR App [err] at com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:2250)
ERR App [err] at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:3035)
ERR App [err] at com.ibm.as400.access.AS400.signon(AS400.java:3910)
ERR App [err] at com.ibm.as400.access.AS400.connectService(AS400.java:1168)
ERR App [err] at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:3300)
ERR App [err] ... 32 more
The JT400 JDBC driver communicates with the IBM i system using the IBM i Host Servers, which each run on different ports. You will need to forward all of these ports through your secure gateway in order for it to work. See this doc for more info (you'll need as-database, as-central, and as-signon at a minimum).
If you need to change the ports used by the app to connect, you can do so by creating an AS400 object and using setServicePort to change the default ports. Then pass the AS400 object to connect instead of using the system, user name, and password.
这篇关于如何将bluemix应用程序连接到本地db / as400?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!