Re: Connection Pooling HELP
Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
Simple solution, don't use the LE version. Use the full version. Your problems will disappear. -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 2:07 PM To: 'Tomcat Users List' Subject: RE: Connection Pooling HELP I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
Thanks. But if this is the case, the download documentation might need some updating. The documentation used to specify that if you have JDK 1.4.x you only needed the LE version. It said nothing about commons jar files. And now, I can't find anything anywhere that specifies which one you should get. But thanks for the heads-up. ;) Gregg -Original Message- From: Angus Mezick [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 1:18 PM To: Tomcat Users List Subject: RE: Connection Pooling HELP Simple solution, don't use the LE version. Use the full version. Your problems will disappear. -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 2:07 PM To: 'Tomcat Users List' Subject: RE: Connection Pooling HELP I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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(htmlbody); out.println(h2Using 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(bGot Connection:/b + conn.toString() + p); Statement stmt = conn.createStatement(); String sql = select * from BSSTYL; ResultSet rst = stmt.executeQuery(sql); if (rst.next()) { out.println(bValue 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]
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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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(htmlbody); out.println(h2Using 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(bGot Connection:/b + conn.toString() + p); Statement stmt = conn.createStatement(); String sql = select * from BSSTYL; ResultSet rst = stmt.executeQuery(sql); if (rst.next()) { out.println(bValue 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
RE: Connection Pooling Help
Try changing the following parameter value in server.xml file valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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(htmlbody); out.println(h2Using 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(bGot Connection:/b + conn.toString() + p); Statement stmt = conn.createStatement(); String sql = select * from BSSTYL; ResultSet rst = stmt.executeQuery(sql); if (rst.next()) { out.println(bValue 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
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 valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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(htmlbody); out.println(h2Using 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(bGot Connection:/b + conn.toString() + p); Statement stmt = conn.createStatement(); String sql = select * from BSSTYL
RE: Connection Pooling Help
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 valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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(htmlbody); out.println(h2Using Tomcat Connection Pooling with DBCP/h2
RE: Connection Pooling Help
The main problem if you are using apache or not, is the connector. I don't know if you are using apache but if you are using apache with tomcat DON'T USE the WebApp connector, is not maintained anymore and does not work correctly with apache 1.*, 2.*. USE mod_jk2 it works fine with the pool connection. I had the same problem a few days ago and I resolve the problem changing connectors. I hope this help. Quoting Manavendra Gupta [EMAIL PROTECTED]: 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 valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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
RE: Connection Pooling Help
Thanks for the reply. How do i make it a global resource? Just declare the resource in the global section? -Original Message- From: Bodycombe, Andrew [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 8:09 PM To: '[EMAIL PROTECTED]' Subject: RE: Connection Pooling Help 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 valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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
RE: Connection Pooling Help
No, i am not using apache - its a standalone version of tomcat. To be honest, I find it rather awkward to be worried about the mod_jk versions, or whether i have a paricular module installed or using a particular connector, etc. With a tool being into such a wide use, I'm sure there are people who have done this before, but somehow, either I am missing something significant, or maybe others went through the same ordeal and have been unable to reproduce what they did, or maybe its just dumb hard luck! -Original Message- From: Roberto Bouza [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 8:19 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Connection Pooling Help The main problem if you are using apache or not, is the connector. I don't know if you are using apache but if you are using apache with tomcat DON'T USE the WebApp connector, is not maintained anymore and does not work correctly with apache 1.*, 2.*. USE mod_jk2 it works fine with the pool connection. I had the same problem a few days ago and I resolve the problem changing connectors. I hope this help. Quoting Manavendra Gupta [EMAIL PROTECTED]: 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 valuejdbc:as400://10.0.0.1/value valuejdbc: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 namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueINTERNET/value /parameter parameter namepassword/name valueINTERNET/value /parameter parameter namedriverClassName/name valuecom.ibm.as400.access.AS400JDBCDriver/value /parameter parameter nameurl/name valuejdbc: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