|
For what it is worth, here is some simplified code snippets of how we use the connection manager. Put the following in the init() method of the servlet and make connectionBroker a class variable. connectionBroker = new DbConnectionBroker(poolName, waitRetry,driver,database,user,password,maxConnections, minConnections); Then in the execute method of the servlet: IBMJdbcConn ibmJdbcConnection = connectionBroker.getConnection(); Connection connection = ibmJdbcConnection.getJdbcConnection(); String sql = "Select * from ORDER where CUSTNAME = 'SMITH'"; Statement statement = null; try { statement = connection.createStatement(); statement.executeQuery(sql); // do something with the result set returned } catch (Exception e){} finally { try {statement.close();} catch (Exception e){} connectionBroker.freeConnection(ibmJdbcConnection); } ----- Original Message ----- From: Richard Dean <rddean@gdi.net> To: <JAVA400-L@midrange.com> Sent: Friday, January 28, 2000 9:45 AM Subject: RE: switching from toolbox to native DB2 JDBC drivers > Luther, have you tried your servlet with out using the connection manager? > I have just recently made this same switch(from toolbox JDBC to native DB2 > JDBC) in my sample servlet and it worked. If you try it without connection > manager maybe it would help you eliminates some potential problems? Let me > know if you would like me to e-mail you what I have done. > > Also once you do get it working with the connection manager let me know, or > better yet post it here, because that is my next project. > > Thanks, > Richard > > > > -----Original Message----- > From: owner-java400-l@midrange.com > [mailto:owner-java400-l@midrange.com]On Behalf Of Luther Ananda Miller > Sent: Friday, January 28, 2000 6:10 AM > To: L-JAVA400@midrange.com > Subject: switching from toolbox to native DB2 JDBC drivers > > > I am attempting to switch a server app (servlet running under websphere > 2.02) on our AS/400 (JDK 1.1.7) over from using the toolbox JDBC drivers to > the native DB2 drivers. > > The connection manager is unable to open a connection. > > If I use the Toolbox instead of the DB2 native drivers, then I do not get > any of these problems. > I tried adding /QIBM/ProdData/Java400/jdk117/db2_classes.jar to my class > path in the bootstrap props but that did not seem to make a difference (I > think they already in the system classpath which is set to be used). > > If anyone knows what I am doing wrong, or how to correct this, please let me > know! Thanks! > > TIA, > Luther > > PS: Exception details from the logs: > > > The servletservice error_log has the following Exception (this occurs when > the connection manager is asked to provide a connection): > > [28 January 2000 20:04:56] Exception raised in servlet invoker. > [28 January 2000 20:04:56] START EXCEPTION BLOCK > [28 January 2000 20:04:56] com.ibm.servlet.engine.SEInvokerException: > java.lang.UnsatisfiedLinkError > com/ibm/db2/jdbc/app/T.initTrace()V+189 (T.java:103) > com/ibm/db2/jdbc/app/DB2Driver.<clinit>()V+36 (DB2Driver.java:147) > > com/ibm/servlet/connmgr/IBMJdbcConnPool.addConnection(Lcom/ibm/servlet/connm > gr/IBMConnSpec;)Lcom/ibm/servlet/connmgr/IBMConnection;+11 > (IBMJdbcConnPool.java:136) > > com/ibm/servlet/connmgr/IBMConnPool.getConnectionFromPool(Lcom/ibm/servlet/c > onnmgr/IBMConnSpec;Ljava/lang/String;)Lcom/ibm/servlet/connmgr/IBMConnection > ;+169 (IBMConnPool.java:452) > > com/ibm/servlet/connmgr/IBMConnMgr.getIBMConnection(Lcom/ibm/servlet/connmgr > /IBMConnSpec;Ljava/lang/String;)Lcom/ibm/servlet/connmgr/IBMConnection;+33 > (IBMConnMgr.java:398) > > com/ibm/servlet/connmgr/IBMConnMgr.getIBMConnection(Lcom/ibm/servlet/connmgr > /IBMConnSpec;)Lcom/ibm/servlet/connmgr/IBMConnection;+1 > (IBMConnMgr.java:367) > > com/hypere/ebiz/server/RequestServerHttpServlet.processRequests(Ljavax/servl > et/http/HttpSession;[Lcom/hypere/ebiz/edata/Request;)[Lcom/hypere/ebiz/edata > /Response;+57 (RequestServerHttpServlet.java:450) > > com/hypere/ebiz/server/RequestServerHttpServlet.doPost(Ljavax/servlet/http/H > ttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+133 > (RequestServerHttpServlet.java:125) > > javax/servlet/http/HttpServlet.service(Ljavax/servlet/http/HttpServletReques > t;Ljavax/servlet/http/HttpServletResponse;)V+142 (HttpServlet.java:521) > > javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/ > servlet/ServletResponse;)V+25 (HttpServlet.java:588) > > com/sun/server/ServletState.callService(Ljavax/servlet/ServletRequest;Ljavax > /servlet/ServletResponse;)V+50 (ServletState.java:316) > > com/sun/server/ServletManager.callServletService(Ljava/lang/String;Ljavax/se > rvlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+81 > (ServletManager.java:1323) > > com/ibm/servlet/engine/SEServletManager.callServletService(Ljava/lang/String > ;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+12 > (SEServletManager.java:133) > > com/sun/server/http/InvokerServlet.service(Ljavax/servlet/http/HttpServletRe > quest;Ljavax/servlet/http/HttpServletResponse;)V+131 > (InvokerServlet.java:104) > > javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/ > servlet/ServletResponse;)V+25 (HttpServlet.java:588) > > com/sun/server/ServletState.callService(Ljavax/servlet/ServletRequest;Ljavax > /servlet/ServletResponse;)V+50 (ServletState.java:316) > > com/sun/server/ServletManager.callServletService(Ljava/lang/String;Ljavax/se > rvlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+81 > (ServletManager.java:1323) > > com/ibm/servlet/engine/SEServletManager.callServletService(Ljava/lang/String > ;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+12 > (SEServletManager.java:133) > com/sun/server/ProcessingState.invokeTargetServlet()V+106 > (ProcessingState.java:434) > > com/sun/server/http/HttpProcessingState.execute(Lcom/sun/server/ProcessingSt > age;)V+29 (HttpProcessingState.java:93) > > com/sun/server/ProcessingSupport.process(Lcom/sun/server/ProcessingState;Lja > vax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)Z+73 > (ProcessingSupport.java:260) > > com/sun/server/Service.process(Lcom/sun/server/ProcessingState;Ljavax/servle > t/ServletRequest;Ljavax/servlet/ServletResponse;)Z+11 (Service.java:229) > > com/ibm/servlet/engine/SELauncher.processMultiThreaded(Lcom/ibm/servlet/engi > ne/SEService;Lcom/ibm/servlet/engine/SEConnectionHandler;)Z+13 > (SEEngine.java:563) > > com/ibm/servlet/engine/SEEngine.service(Lcom/ibm/servlet/engine/api/IAppServ > erConnection;)V+117 (SEEngine.java:312) > > com/ibm/servlet/engine/api/ServerEntry.service(Lcom/ibm/servlet/engine/api/I > ServerRequestConnection;)I+89 (ServerEntry.java:201) > > com/ibm/servlet/engine/nativeEntry/NativeServerEntry.service(JJILjava/lang/S > tring;Ljava/lang/String;)I+48 (NativeServerEntry.java:144) > > > > The jvm_stderr.log is filled with the following exceptions (this exception > appears to occur when the servlet is intitialized, thus initializing the > connection manager): > > java.lang.ClassNotFoundException: > com.ibm.security12.sun.security.provider.IdentityDatabase > java/security/IdentityScope.initializeSystemScope()V+11 > (IdentityScope.java:65) > > java/security/IdentityScope.getSystemScope()Ljava/security/IdentityScope;+6 > (IdentityScope.java:115) > sun/tools/jar/JarVerifierStream.<init>(Ljava/io/InputStream;)V+80 > (JarVerifierStream.java:88) > > com/ibm/servlet/classloader/JarFileClassProvider.hasResource(Ljava/lang/Stri > ng;)Z+43 (JarFileClassProvider.java:88) > > com/ibm/servlet/classloader/JarDirClassProvider.hasResource(Ljava/lang/Strin > g;)Z+7 (JarDirClassProvider.java:104) > > com/ibm/servlet/classloader/DynamicClassLoader.getNonSystemResourceAsStream( > Ljava/lang/String;)Ljava/io/InputStream;+26 (DynamicClassLoader.java:60) > > com/ibm/servlet/classloader/ClassLoaderTemplate.getResourceAsStream(Ljava/la > ng/String;)Ljava/io/InputStream;+9 (ClassLoaderTemplate.java:68) > > com/ibm/servlet/classloader/PowerClassLoader.getNonSystemResourceAsStream(Lj > ava/lang/String;)Ljava/io/InputStream;+4 (PowerClassLoader.java:59) > > com/ibm/servlet/classloader/ClassLoaderTemplate.getResourceAsStream(Ljava/la > ng/String;)Ljava/io/InputStream;+9 (ClassLoaderTemplate.java:68) > > com/ibm/servlet/engine/SEServletManager.loadServlet(Ljava/lang/String;)V+32 > (SEServletManager.java:163) > com/sun/server/ServletManager.loadStartupServlets()V+73 > (ServletManager.java:490) > com/sun/server/http/HttpService.run()V+181 (HttpService.java:195) > java/lang/Thread.run()V+11 (Thread.java:466) > > luther.miller @ hypere.com > > > +--- > | This is the JAVA/400 Mailing List! > | To submit a new message, send your mail to JAVA400-L@midrange.com. > | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. > | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner: joe@zappie.net > +--- > > +--- > | This is the JAVA/400 Mailing List! > | To submit a new message, send your mail to JAVA400-L@midrange.com. > | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. > | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner: joe@zappie.net > +--- > +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.