tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <>
Subject Re: how to over come toomanyconnection error when communicatingMYSQL
Date Fri, 11 Aug 2006 06:59:12 GMT
prakash shanmugam wrote:
> hai all,
> i have one major issue in my project..
> My project is developed using jsp,servlets in Tomcat5 with MySql as
> database.. i am using type1 driver
> My project is now used by end users in intranet..
> When multiple users are accessing at the same time ,its throwing too many
> connections exception at sometimes . And at sometimes its dispaying 
> error as
> "Operation not allowed after ResultSet is closed"
> i dont know how to rectify this .. Can anybody help me to overcome this..
> Here is my bean file used for establing database connections...
This is a design issue problem. This is wrong for several reason:
1) you need to go through the authentification protocol each time a page 
is requested, depending on database type, and server load, this can take 
up to 1 seconds (it can sometime take up to 2 seconds on overloaded 
oracle database , by experience)
2) several concurrent page load mean several concurrent  acces to your 
class, however, your class is designed with only static method, there is 
no concurrency check, very bad (probably the reason of your already 
closed exceptions)
3) your are hardcoding the various db information, including password
4) if something prevent call to CloseAll() (like another exception 
during process), you get a connection which is pending open.

1) use database pooling (allows for concurrency while not needing to 
authenticate each time), and prefer the use of a jndi datasource for 
your pooling
2) as it seems you are reading quite simple classical datas from a 
database, i recommend the use of some automated persistence, like 
hibernate 3. ( This can take you 2 or 3 days 
to learn and an additionnal day to set it up, but when it comes to 
accessing database and presenting the datas as object which gets 
automatically persisted / updated, you are gaining lots of developpment 
time and make your code very easier to read.
> Hope Any of u can help me.. it would be very much helpful to me if any 
> body
> suggest me a solution to this... Because of this issue my project is in
> pending..
> Thanks in Advance

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message