What do you guys think of DBCP? Any specific comments on performance or functionality? Do you think it's ready for a "production" project? Should I use it over DbConnectionBroker (obviously not a JNDI solution, but it works pretty well).
I'd love to hear a review from someone who's been using DBCP. Cindy On Sun, 26 May 2002, Jacob Kjome wrote: > See... > > http://marc.theaimsgroup.com/?l=tomcat-user&m=102230335008606&w=2 > > and > > http://marc.theaimsgroup.com/?l=tomcat-user&m=102230398708809&w=2 > > which both reference... > > http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2 > > it provides a pretty definitive and working solution for using DBCP > > Jake > > > At 11:38 AM 5/26/2002 +0100, you wrote: > >You probably only downloaded the source, try a nightly build > >http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp/ > > > >And could you keep your mails to the list instead of direct? That way (a) > >someone else might answer first and (b) the answer will end up in the mail > >archives. > > > >Thanks > > > >Les > > > > > > > -----Original Message----- > > > From: Rick Fincher [mailto:[EMAIL PROTECTED]] > > > Sent: 24 May 2002 18:37 > > > To: [EMAIL PROTECTED] > > > Subject: Re: Connection Pooling Solution > > > > > > > > > Thanks a million Les, > > > > > > This is very helpful. > > > > > > Quick question: I didn't see a jar in th DBCP nightly build after I > > > downloaded it, how do you build this thing? > > > > > > Thanks again, > > > > > > Rick > > > > > > ----- Original Message ----- > > > > > > > Hi all, > > > > > > > > Having "felt the pain" in getting connection pooling to > > > work with TC 4.0.3 > > > > I've knocked up a simple howto. This is for TC 4.0.3 JDK > > > 1.4, mySQL 4.0 > > > > Alpha so YMMV. > > > > > > > > Enjoy, > > > > > > > > Les > > > > > > > > I Downloaded: > > > > > > > > Tomcat 4.0.3 LE JDK 1.4 Build > > > > mySQL 4.0.1 alpha > > > > mm.mysql 2.0.14 > > > > > > > > Jakarta-Commons projects > > > > DBCP Nightly Build 20020523 > > > > collections 2.0 > > > > pool 1.0 > > > > > > > > Install mm.mysql, DBCP, collections and pool jars into > > > > CATALINA_HOME/common/lib > > > > > > > > In mySQL, I created a simple DB call javatest with a single table > > > (testdata) > > > > and a new user (javauser) with the password javadude. > > > > > > > > > > > > I created a new Context for my test web app, here's the > > > full server.xml > > > > entry: > > > > > > > > <Context path="/DBTest" docBase="DBTest" > > > > debug="5" reloadable="true" crossContext="true"> > > > > > > > > <Logger className="org.apache.catalina.logger.FileLogger" > > > > prefix="localhost_DBTest_log." suffix=".txt" > > > > timestamp="true"/> > > > > > > > > <Resource name="jdbc/TestDB" auth="Container" > > > > type="javax.sql.DataSource"/> > > > > > > > > <ResourceParams name="jdbc/TestDB"> > > > > <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>javauser</value></parameter> > > > > > > > <parameter><name>password</name><value>javadude</value></parameter> > > > > > > > > <parameter> > > > > > > > <name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value> > > > > </parameter> > > > > > > > > <parameter> > > > > > > > <name>url</name><value>jdbc:mysql://localhost:3306/javatest</value> > > > > </parameter> > > > > </ResourceParams> > > > > </Context> > > > > > > > > And of course, you'll need this in your web.xml > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?> > > > > <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD > > > Web Application > > > > 2.3//EN" > > > > "http://java.sun.com/dtd/web-app_2_3.dtd"> > > > > <web-app> > > > > <description>mySQL Test App</description> > > > > <resource-ref> > > > > <description>DB Connection</description> > > > > <res-ref-name>jdbc/TestDB</res-ref-name> > > > > <res-type>javax.sql.DataSource</res-type> > > > > <res-auth>Container</res-auth> > > > > </resource-ref> > > > > </web-app> > > > > > > > > And a snippet of Java to use this:- > > > > > > > > try{ > > > > Context ctx = new InitialContext(); > > > > if(ctx == null ) throw new Exception("Boom - No > > > Context"); > > > > > > > > DataSource ds = > > > > (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB"); > > > > if (ds != null) { > > > > > > > > Connection conn = ds.getConnection(); > > > > > > > > if(conn != null) { > > > > foo = "Got Connection "+conn.toString(); > > > > Statement stmt = conn.createStatement(); > > > > ResultSet rst = > > > stmt.executeQuery("select id, foo, bar > > > > from testdata"); > > > > if(rst.next()) { > > > > foo=rst.getString(2); > > > > bar=rst.getInt(3); > > > > } > > > > conn.close(); > > > > } > > > > } > > > > }catch(Exception e) { > > > > e.printStackTrace(); > > > > } > > > > > > > > > > > > That's all folks.....Hope this is of use to you. > > > > > > > > > > > > > > > > -- > > > > 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]>