Thanks Jacob!
My problem was an unsuccessful close on one of my major servlets. Just a
lame oversight on my part that caused a large headache. So for everyone
else...REMEMBER to close your connections!!!!!
Steve
-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 7:39 AM
To: Tomcat Users List
Subject: Re: DataSource misconfigured?
Are you using a finally bock to close your connections? You might be
reaching the maximum connections allowed in the pool for DBCP. Please
provide an example of a query statement where you do try/catch/finally. If
you are not checking if your connections are not null and then making a
last ditch attempt to close them in the finally block, then that may very
well be the problem.
Also, your URL should have "?autoReconnect=true" appended to the "url"
value since you are using MySQL.
Jake
At 10:29 PM 3/31/2003 -0700, you wrote:
>Hello Again Everyone! I know I have already sent out a message or three
>about this, but I need to resolve it pretty quickly. I found a work
around,
>but I would like a sanity check from those of you who really understand
this
>stuff. I included a method that I wrote to get Connections, You can see
the
>old and the new along side each other. The "manual" method allows me to
>query till the cows come home.. The "Resource" method gives me 12 DB hits
on
>4.1.18 and 5 on 4.1.24 (tested on both solaris 8 and 9) before it appears
to
>hang. Oddly enough I can't pinpoint what is hanging because I have added
>log statements to this method and it appears to be working.. but
>substituting those two lines below removes the issue, so I believe it is
>returning an invalid connection or something that I don't understand.
>
>Thanks for any time spent on reading this!
>
> /******************** Method Start ************************/
> public static Connection getConnection () throws Exception {
>
> Connection connection;
> try {
> /*********** Old Version
> Context ctx = new InitialContext ();
> if ( ctx == null )
> throw new Exception ("No Context");
> DataSource ds;
> ds = (DataSource)ctx.lookup ("java:comp/env/jdbc/CIHDB");
> if ( ds != null )
> connection = ds.getConnection();
> else {
> return null;
> }//end of else
> ************ End of old version */
> Class.forName ("com.mysql.jdbc.Driver").newInstance();
> connection = DriverManager.getConnection (
> "jdbc:mysql://localhost/cih",
> "User","PassWord");
> }//end of try
> catch ( Exception e ) {
> throw (e);
> }//end of catch
> return connection;
> }//end getConnection
>
>/***** Web.xml definition
> <resource-ref>
> <description>
> Resource reference to a factory for java.sql.Connection
> instance that may be used for talking to a particular
> database that is configured in the server.xml file
> </description>
> <res-ref-name>jdbc/CIHDB</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
>/****** server.xml
> <Context path="/cih" docBase="cih" debug="0"
> reloadable="true" crossContext="true">
>
> <Logger className="org.apache.catalina.logger.FileLogger"
> prefix="localhost_CIH." suffix=".txt"
> timestamp="true"/>
>
> <Resource name="jdbc/CIHDB"
> auth="Container"
> type="javax.sql.DataSource"/>
>
> <ResourceParams name="jdbc/CIHDB">
> <parameter>
> <name>factory</name>
>
><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>User</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>Password</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>com.mysql.jdbc.Driver</value>
> </parameter>
> <parameter>
> <name>url</name>
> <value>jdbc:mysql://localhost/cih</value>
> </parameter>
> <parameter>
> <name>removeAdandoned</name>
> <value>true</value>
> </parameter>
> <parameter>
> <name>removeAdandonedTimeout</name>
> <value>120</value>
> </parameter>
> <parameter>
> <name>MaxActive</name>
> <value>50</value>
> </parameter>
> <parameter>
> <name>MaxIdle</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>MaxWait</name>
> <value>200</value>
> </parameter>
> </ResourceParams>
> </Context>
>
>Steve Gums
>
>
>---------------------------------------------------------------------
>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]