Hi,
I want to setup a DB2 datasource for my WebSphere Studio Appl Development Client's (V4.0)
test Application Server. The DB2 database I want to access is on an AS400 (V5R1). My guess is that I do this on the Server Perspective in the Server Configuration box. I double click on WebSphere Admin Domain under Server Configurations and then select the data sources tab.
On the data sources panel it has three areas: the
JDBC Driver List, the Data Source defined in the JDBC driver, and the Resource Properties defined in the data source.
In the JDBC Driver List area I have and entry:
----------------------------------------------
Name: AS400JDBCDriver(com.ibm.as400.access.AS400JDBCConnectionPoolDataSource)
When I edit this entry I have:
------------------------------
Name: AS400JDBCDriver
Desc: <Blank>
Implementation Class Name: com.ibm.as400.access.AS400JDBCConnectionPoolDataSource
URL prefix: jdbc

b2
Class path: c:/WSADClassPathStuff/jt400.jar
I downloaded this jt400.jar file from the AS400's QIBM/ProdData/HTTP/Public/jt400/lib directory and put it in this WSADClassPathStuff local directory.
When I select the "Data Source defined in the JDBC driver" entry, I have:
-------------------------------------------------------------------------
Name: AS400DataSource
JNDI name: jdbc/cmas400
Desc: <blank>
Category:<blank>
Database name: cmas400/cmas400 (which is the system name followed by the database name)
Default user Id & Password: I have a valid userid & password entered
The rest of the entries are at their default values.
My
Servlet has:
---------------
Connection connection = null;
try {
Properties parms = new Properties();
parms.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
Context context = new InitialContext(parms);
DataSource ds = (DataSource) context.lookup("jdbc/cmas400");
connection = ds.getConnection();
} catch (Exception e) {
System.out.println(" Servlet ERROR: " + e.getMessage());
}
Finally, also in my WebSphere Test server Environment confirguration I have this class path entry:
C:/WSADClassPathStuff/jt400.jar
This was added with the "Add External Jar's" button.
When I start the server I see:
-------------------------------
[10/25/02 8:48:22:890 PDT] 5197252 Server U Version : 4.0.2
[10/25/02 8:48:22:890 PDT] 5197252 Server U Edition: Advanced Single Server Edition for Multiplatforms
[10/25/02 8:48:22:890 PDT] 5197252 Server U Build date: Tue Dec 18 00:00:00 PST 2001
[10/25/02 8:48:22:890 PDT] 5197252 Server U Build number: a0150.05
[10/25/02 8:48:25:000 PDT] 5197252 DrAdminServer I WSVR0053I: DrAdmin available on port 7000
[10/25/02 8:48:25:078 PDT] 5197252 ResourceBinde I WSVR0049I: Binding Session Persistence datasource as jdbc/Session
[10/25/02 8:48:25:093 PDT] 5197252 ResourceBinde I WSVR0049I: Binding AS400DataSource as jdbc/cmas400
[10/25/02 8:48:26:296 PDT] 5197252 ServletEngine A SRVE0161I: IBM WebSphere Application Server - Web Container. Copyright IBM Corp. 1998-2001
[10/25/02 8:48:26:390 PDT] 5197252 ServletEngine A SRVE0162I: Servlet Specification Level: 2.2
[10/25/02 8:48:26:390 PDT] 5197252 ServletEngine A SRVE0163I: Supported
JSP Specification Level: 1.1
[10/25/02 8:48:26:546 PDT] 5197252 ServletEngine A SRVE0167I: Session Manager is Configured - Initializing...
[10/25/02 8:48:26:687 PDT] 5197252 CacheManager A DYNA0011E: Servlet cache file dynacache.xml not found; caching is disabled
[10/25/02 8:48:26:734 PDT] 5197252 ServletEngine A SRVE0169I: Loading Web Module: IBM
EJB Test Client.
[10/25/02 8:48:27:421 PDT] 5197252 WebGroup I SRVE0091I: [Servlet LOG]: JSP 1.1 Processor: init
[10/25/02 8:48:27:468 PDT] 5197252 WebGroup I SRVE0091I: [Servlet LOG]: SimpleFileServlet: init
[10/25/02 8:48:27:781 PDT] 5197252 ServletEngine A SRVE0169I: Loading Web Module: WebPractice.
[10/25/02 8:48:28:046 PDT] 5197252 WebGroup I SRVE0091I: [Servlet LOG]: JSP 1.1 Processor: init
[10/25/02 8:48:28:062 PDT] 5197252 WebGroup I SRVE0091I: [Servlet LOG]: SimpleFileServlet: init
[10/25/02 8:48:28:078 PDT] 5197252 WebGroup I SRVE0091I: [Servlet LOG]: InvokerServlet: init
[10/25/02 8:48:28:156 PDT] 5197252 HttpTransport A SRVE0171I: Transport http is listening on port 8,080.
[10/25/02 8:48:28:234 PDT] 5197252 Server A WSVR0023I: Server Default Server open for e-business
When my servlet runs and it executes the "connection = ds.getConnection();" statement I get the message:
[10/25/02 8:50:21:750 PDT] 55423256 DataSourcePro W CONM7002W: Could not find the property connectionAttribute on class com.ibm.as400.access.AS400JDBCConnectionPoolDataSource
Which I understand is not a problem message and can be ignored. However, at this point my servlet is locks up and doesn't continue with the next statements. If I try to stop the server I get a pop up window that says "WebSphere v4.0 test environment is not responding. Do you want to terminate the server?" At this point the new messages on the console are:
[10/25/02 8:53:11:718 PDT] 507f252 SystemOut U Received stop server message.
[10/25/02 8:53:11:843 PDT] 348cb254 SystemOut U
[10/25/02 8:53:11:843 PDT] 348cb254 SystemOut U WebSphere Application Server, Advanced Single Server Edition V4.0
WebSphere Application Server, Advanced Developer Edition V4.0
WebSphere Application Server, Advanced Edition V4.0
[10/25/02 8:53:11:843 PDT] 348cb254 SystemOut U Runtime Utility Program
[10/25/02 8:53:11:843 PDT] 348cb254 SystemOut U Copyright (C) IBM Corporation, 1997-2001
[10/25/02 8:53:11:859 PDT] 348cb254 SystemOut U
[10/25/02 8:53:11:859 PDT] 348cb254 SystemOut U WSRU0025I: Loading configuration from file.
[10/25/02 8:53:11:859 PDT] 348cb254 SystemOut U WSRU0028I: Using the specified configuration file:
[10/25/02 8:53:11:859 PDT] 348cb254 SystemOut U C:/WDSC/WSSD/workspace/Servers/defaultConfiguration.wsc\server-cfg.xml
[10/25/02 8:53:12:000 PDT] 348cb254 SystemOut U WSRU0029I: The diagnostic host name read as localhost.
[10/25/02 8:53:12:000 PDT] 348cb254 SystemOut U WSRU0030I: The diagnostic port was read as 7000.
[10/25/02 8:53:12:062 PDT] 348cb254 SystemOut U Stopping server.
[10/25/02 8:53:12:078 PDT] 2890f251 ConnectionPoo A CONM6007I: The connection pool was destroyed for data source (AS400DataSource).
[10/25/02 8:53:12:093 PDT] 2890f251 HttpTransport A SRVE0172I: Stopped transport http on port 8,080.
[10/25/02 8:53:12:093 PDT] 2890f251 ServletEngine A SRVE0170I: Stopping Web Module: WebPractice.
At this point I get a pop-up window that wants me to identify a System, UserId, and password. I enter the system name, a valid userid and password and submit it. After a moment I get:
[10/25/02 9:05:23:625 PDT] 64eb34a6 ConnectionPoo X CONM6009E: Failed to get connection to the database from datasource (AS400DataSource).
[10/25/02 9:05:23:625 PDT] 64eb34a6 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.(cmas400)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365)
at com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnection.java:1912)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataSource.java:348)
at com.ibm.as400.access.AS400JDBCDataSource.getConnection(AS400JDBCDataSource.java:336)
at com.ibm.as400.access.AS400JDBCConnectionPoolDataSource.getPooledConnection(AS400JDBCConnectionPoolDataSource.java:157)
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 internetRES.reservationInfoController.performTask(reservationInfoController.java:59)
at internetRES.reservationInfoController.doPost(reservationInfoController.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
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.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:122)
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)
[10/25/02 9:05:23:796 PDT] 64eb34a6 SystemOut U reservationInfoController Servlet ERROR: The application requester cannot establish the connection.(cmas400)
I hope someone can help me resolve this probem. Email me if you need addition information.
Thanks,
Reed Peters