I've not done it myself in tomcat, only in EJB containers, but as a starting point, I would suggest trying to get it to work by setting the connection pool as a global resource instead of a resource specific to your context.
Then try and get your context-specific connection pool working. I too am surprised by the number of people facing this problem. Andy. -----Original Message----- From: Manavendra Gupta To: Tomcat Users List Sent: 09/12/2002 14:14 Subject: RE: Connection Pooling Help I am surprised with the number of ppl facing this problem, including myself. And it makes me wonder how others on this list have been able to use DataSource/Connection Pooling with tomcat. It seems to be one feature where majority of ppl have been facing problems, yet there is not much of information on this (including the JNDI HOW-TO). It would be interesting to hear from someone who had faced and subsequently resolved this problem. Manav. -----Original Message----- From: Hari Venkatesan [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 7:27 PM To: Tomcat Users List Subject: RE: Connection Pooling Help Try changing the following parameter value in server.xml file <value>jdbc:as400://10.0.0.1</value> <value>jdbc:as400://{name of your machine} </value> instead of the ip address of the as400 Hari -----Original Message----- From: Kevin Passey [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 8:40 AM To: 'Tomcat Users List' Subject: RE: Connection Pooling Help Eric, It's the same - DS == null. :-( Thanks anyway. Kevin -----Original Message----- From: Roberts, Eric [mailto:[EMAIL PROTECTED]] Sent: 09 December 2002 13:33 To: Tomcat Users List Subject: RE: Connection Pooling Help Kevin, Try: Context ctx = new InitialContext(); Context envCtx = (Context) ctx.lookup("java:/comp/env/"); DataSource ds = (DataSource) envCtx.lookup("/jdbc/shiltonDB"); -----Original Message----- From: Kevin Passey [mailto:[EMAIL PROTECTED]] Sent: Montag, 09. Dezember 2002 14:25 To: Tomcat Users List (E-mail) Subject: Connection Pooling Help Hi, Can somebody point out my mistake for me - I'm starting to bang my head.. I am trying to get connection pooling working on my AS/400 using the Commons-DBCP. I have placed this JAR in <TOMCAT_HOME>/common/lib along with the JT400.JAR I have added the context entries to my server.xml file - thus:- <!-- AS400 Connection Pooling Test --> <Context path="/shilton" docBase="shilton" debug="5" reloadable="true" crossContext="true"> <Resource name="jdbc/shiltonDB" auth="Container" type="javax.sql.DataSource" /> <ResourceParams name="jdbc/shiltonDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30000</value> </parameter> <parameter> <name>maxWait</name> <value>100</value> </parameter> <parameter> <name>username</name> <value>INTERNET</value> </parameter> <parameter> <name>password</name> <value>INTERNET</value> </parameter> <parameter> <name>driverClassName</name> <value>com.ibm.as400.access.AS400JDBCDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:as400://10.0.0.1</value> </parameter> </ResourceParams> </Context> I have added this to my WEB-INF web.xml file:- <resource-ref> <description> Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. </description> <res-ref-name> jdbc/shiltonDB </res-ref-name> <res-type> javax.sql.DataSource </res-type> <res-auth> Container </res-auth> </resource-ref> And I have this java program to test the connection import javax.naming.*; import javax.sql.*; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletOutputStream; import java.sql.*; public class DBCPServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { try { ServletOutputStream out = res.getOutputStream(); out.println("<html><body>"); out.println("<h2>Using Tomcat Connection Pooling with DBCP</h2>"); Context ctx = new InitialContext(); if (ctx == null) out.println("Something is wrong with Tomcat"); DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/shiltonDB"); if (ds != null) { Connection conn = ds.getConnection(); if (conn != null) { out.println("<b>Got Connection:</b> " + conn.toString() + "<p>"); Statement stmt = conn.createStatement(); String sql = "select * from BSSTYL"; ResultSet rst = stmt.executeQuery(sql); if (rst.next()) { out.println("<b>Value of HDCUST on first record:</b> "+ rst.getString("dbfield1")+ "<p>"); } out.println("This was our little database-access servlet..."); conn.close(); } } } catch (Exception e) { e.printStackTrace(); } } /** * if somebody does a http-post, we do an interal dispatch to doGet() */ public void doPost(HttpServletRequest req, HttpServletResponse res) { doGet(req, res); } } "ds" is alway null - what am I missing. Thanks in advance. Kevin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>