8 Replies Latest reply on Mar 3, 2010 8:01 AM by PhHein

    DB2 connectivity using jdbc

    843859

      Hi,

      I am getting an error while i try to establish a connection to a mainframe DB2. Here is the code

      try {
      context = new InitialContext();
      dataSource = (DataSource) context.lookup("jdbc/sampleDS");
      Connection con=dataSource.getConnection();
      } catch (NamingException ne) {
      System.out.println(ne);
      } catch (SQLException e) {
      e.printStackTrace();
      }
      com.ibm.db2.jcc.b.DisconnectException: Execution failed due to a distribution protocol error that caused deallocation of the conversation. A DRDA Data Stream Syntax Error was detected. Reason: 0x3

      I have configured the datasource in my server config.

      Please help me...

        • 1. Re: DB2 connectivity using jdbc
          800649
          check your db connection url plz
          • 2. Re: DB2 connectivity using jdbc
            843859
            Ya i m sure my datasource config r correct.
            • 3. Re: DB2 connectivity using jdbc
              843859
              Show the complete stacktrace.

              And please write normal human readable English sentences. You're here at a public discussion forum, not at a chat nor instant messaging site nor disney.com or so.
              • 4. Re: DB2 connectivity using jdbc
                843859
                This is the stack trace i am getting....

                E J2CA0046E: Method createManagedConnctionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/sample, throwing ResourceAllocationException. Original exception: com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a PooledConnection from the DataSource.
                     at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:244)
                     at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:171)
                     at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:208)
                     at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:777)
                     at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:641)
                     at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:726)
                     at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1281)
                     at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:1065)
                     at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1603)
                     at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:677)
                     at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:461)
                     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:217)
                     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:192)
                     at com.EmployeeDataAccess.setUp(EmployeeDataAccess.java:39)
                     at com.InsertDetailsController.handleRequest(InsertDetailsController.java:28)
                     at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
                     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723)
                     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
                     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
                     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                     at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
                     at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
                     at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
                     at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
                     at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
                     at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
                     at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
                     at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
                     at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
                     at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
                     at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
                     at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
                     at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
                     at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
                     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
                     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
                Caused by: com.ibm.db2.jcc.b.DisconnectException: Execution failed due to a distribution protocol error that caused deallocation of the conversation. A DRDA Data Stream Syntax Error was detected. Reason: 0x3
                at com.ibm.db2.jcc.a.ba.l(ba.java:946)
                     at com.ibm.db2.jcc.a.ba.c(ba.java:329)
                     at com.ibm.db2.jcc.a.ba.t(ba.java:1112)
                     at com.ibm.db2.jcc.a.bb.a(bb.java:33)
                     at com.ibm.db2.jcc.a.b.a(b.java:892)
                     at com.ibm.db2.jcc.a.b.a(b.java:439)
                     at com.ibm.db2.jcc.a.b.a(b.java:293)
                     at com.ibm.db2.jcc.a.b.<init>(b.java:224)
                     at com.ibm.db2.jcc.a.c.<init>(c.java:31)
                     at com.ibm.db2.jcc.DB2PooledConnection.connect(DB2PooledConnection.java:107)
                     at com.ibm.db2.jcc.DB2PooledConnection.<init>(DB2PooledConnection.java:70)
                     at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnection(DB2ConnectionPoolDataSource.java:77)
                     at com.ibm.db2.jcc.DB2ConnectionPoolDataSource.getPooledConnection(DB2ConnectionPoolDataSource.java:55)
                     at com.ibm.ws.rsadapter.DSConfigurationHelper$1.run(DSConfigurationHelper.java:759)
                     at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
                     at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:754)
                     at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:641)
                     at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:726)
                     at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1281)
                     at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:1065)
                     at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1603)
                     at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:677)
                     at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:461)
                     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:217)
                     at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:192)
                     at com.EmployeeDataAccess.setUp(EmployeeDataAccess.java:39)
                     at com.InsertDetailsController.handleRequest(InsertDetailsController.java:28)
                     at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
                     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723)
                     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
                     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
                     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                     at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
                     at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
                     at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
                     at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
                     at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
                     at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
                     at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
                     at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
                     at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
                     at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
                     at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
                     at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
                     at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
                     at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
                     at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
                     at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
                     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
                • 5. Re: DB2 connectivity using jdbc
                  3004
                  Looks like WebSphere can't talk to the database, therefore can't create connections, therefore can't give you one.

                  Check whether the WS configuration is correct, especially the JDBC URL, and if so whether there is a viable network path between the servers (no firewalls blocking traffic, things like that).
                  • 6. Re: DB2 connectivity using jdbc
                    843859
                    I recently ran into this very same error message when attempting to connect DB2 on iSeries to SQL Developer.
                    SQL Developer by default puts a value of 5000 for the port, so I accepted that value and put in the host and database name and hit test.
                    I got the same error, and after seeing this post, I googled the default port for DB2 on iSeries and found out that the default port was 446.
                    • 7. Re: DB2 connectivity using jdbc
                      jschellSomeoneStoleMyAlias
                      tiamot wrote:
                      I recently ran into this very same error message when attempting to connect DB2 on iSeries to SQL Developer.
                      SQL Developer by default puts a value of 5000 for the port, so I accepted that value and put in the host and database name and hit test.
                      I got the same error, and after seeing this post, I googled the default port for DB2 on iSeries and found out that the default port was 446.
                      Of course that same answer which was posted above was much more helpful to the OP when they posted the question more than a year ago.
                      • 8. Re: DB2 connectivity using jdbc
                        PhHein
                        tiamot, welcome to the forum. Please don't post in threads that are long dead and don't hijack other threads. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.

                        I'm locking this thread now.