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