aspose file tools*
The moose likes Websphere and the fly likes WSAD datasource connection problem to AS400 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "WSAD datasource connection problem to AS400" Watch "WSAD datasource connection problem to AS400" New topic
Author

WSAD datasource connection problem to AS400

Jacob Kur
Ranch Hand

Joined: Jul 17, 2002
Posts: 30
Hi,
I am attempting to connect to an AS400 database using WSAD 4.0.3. The code can connect using the same code in WAS 3.5 and 4.0. But wont work with WSAD. Any help is appreciated
I have created a datasource with -
---------------------------------
Implementation class com.ibm.as400.access.AS400JDBCConnectionPoolDataSource
URL Prefix jdbc:as400
jdbc name jdbc/dbname
User Name - XXX
Password - XXX
Resource Properties list :
------------------------
serverName - myServer
(Also have tried URL and libraries)
my code is as follows:
java.util.Properties parms = new java.util.Properties();
parms.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/dbname");
conn = ds.getConnection();
( Have also tried conn = ds.getConnection(username,password); )
I have tried numerous variation of the all the datasource variables and code variations but to no avail...I know the database is up and running since the same code runs on our production box on WAS 4.0 and 3.5.
The error I get is -
[1/18/03 18:50:51:822 MST] 76c3bf63 ConnectionPoo X CONM6009E: Failed to get connection to the database from datasource (db).
[1/18/03 18:50:51:862 MST] 76c3bf63 StaleConnecti A CONM7007I: Mapping the following SQLException, with ErrorCode -99,999 and SQLState 08001, to a StaleConnectionException: java.sql.SQLException: The application requester cannot establish the connection.(Connection refused: no further information)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:459)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:417)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:2636)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataSource.java:527)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataSource.java:508)
at com.ibm.as400.access.AS400JDBCConnectionPoolDataSource.getPooledConnection(AS400JDBCConnectionPoolDataSource.java:223)
at com.ibm.ejs.cm.pool.JDBC1xConnectionFactory.createConnection(JDBC1xConnectionFactory.java:42)
at com.ibm.ejs.cm.pool.ConnectionPool.createConnection(ConnectionPool.java:954)
at com.ibm.ejs.cm.pool.ConnectionPool.createOrWaitForConnection(ConnectionPool.java:896)
at com.ibm.ejs.cm.pool.ConnectionPool.findFreeConnection(ConnectionPool.java:814)
at com.ibm.ejs.cm.pool.ConnectionPool.findConnectionForTx(ConnectionPool.java:720)
at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:654)
at com.ibm.ejs.cm.pool.ConnectionPool.getConnection(ConnectionPool.java:307)
at com.ibm.ejs.cm.DataSourceImpl$1.run(DataSourceImpl.java:122)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:120)
at com.ibm.ejs.cm.DataSourceImpl.getConnection(DataSourceImpl.java:100)
at _dbtest_jsp_4._jspService(_dbtest_jsp_4.java:102)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:300)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:430)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:565)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:167)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:523)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:282)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:112)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:91)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:184)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:125)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
xin wen
Ranch Hand

Joined: Oct 11, 2002
Posts: 64
Hi, I got the same error, but it will be solved by adding libraries in Resource List, so try to add the libraries.
I hope it will help you a little bit.
Jacob Kur
Ranch Hand

Joined: Jul 17, 2002
Posts: 30
well I had tried libraries but that did not work. However when I changed the serverName variable from the DNS name to the IP it worked....
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSAD datasource connection problem to AS400