You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob Tanner <ta...@real-time.com> on 2000/08/31 21:55:34 UTC

Re: [Tomcat-users] Re: MySQL, Tomcat, Communication Link Error

Quoting Kevin Sangalee (kevin@susa.net):
> Where do you get and release your connections? I've seen errors like that
> when database server daemons have been restarted for whatever reason,
> causing the tcp/ip socket connection to be broken. Perhaps mySQL has a
> configurable timeout on server processes (i.e. to avoid possibility of
> memory wind-ups etc).

I removed the database pooling code, I am going it raw in the init().

      Class.forName(driver).newInstance();
      Connection conn = DriverManager.getConnection(url);
      stmt = conn.createStatement(); 
-- 
Bob Tanner <ta...@real-time.com>       | Phone : (612)943-8700
http://www.mn-linux.org                 | Fax   : (612)943-8500
Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9 


Re: [Tomcat-users] Re: MySQL, Tomcat, Communication Link Error

Posted by Matt Goss <mg...@rtci.com>.
Bob,
Database pooling is a great way to increase the speed of your code (at least by
a factor of 10). I would just edit your database pooling code to check if the
connection is null and create another if so....
Matt Goss

Bob Tanner wrote:

> Quoting Kevin Sangalee (kevin@susa.net):
> > Where do you get and release your connections? I've seen errors like that
> > when database server daemons have been restarted for whatever reason,
> > causing the tcp/ip socket connection to be broken. Perhaps mySQL has a
> > configurable timeout on server processes (i.e. to avoid possibility of
> > memory wind-ups etc).
>
> I removed the database pooling code, I am going it raw in the init().
>
>       Class.forName(driver).newInstance();
>       Connection conn = DriverManager.getConnection(url);
>       stmt = conn.createStatement();
> --
> Bob Tanner <ta...@real-time.com>       | Phone : (612)943-8700
> http://www.mn-linux.org                 | Fax   : (612)943-8500
> Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9

Re: [Tomcat-users] Re: MySQL, Tomcat, Communication Link Error

Posted by Kevin Sangalee <ke...@susa.net>.
If it's in init(), then you're only connecting when the servlet is
first instantiated. If that connection times out, requests to that servlet
will still be trying to use the duff connection. So you're essentially no
further forward unless you either connect on every request or test your
connection before using it and do a getConnection(url) if it fails.

The long term fix will be to check your connection pool and mySQL config.
I've used one called DBConnectionManager with mySQL, I'm not sure but I
think it verifies connections before handing them out (as I'm sure lots of
others do too).

On Thu, 31 Aug 2000, Bob Tanner wrote:

> I removed the database pooling code, I am going it raw in the init().
> 
>       Class.forName(driver).newInstance();
>       Connection conn = DriverManager.getConnection(url);
>       stmt = conn.createStatement(); 
> -- 
> Bob Tanner <ta...@real-time.com>       | Phone : (612)943-8700
> http://www.mn-linux.org                 | Fax   : (612)943-8500
> Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9 
> 
>