aspose file tools*
The moose likes Java in General and the fly likes How to solve Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to solve "Too many connections" error" Watch "How to solve "Too many connections" error" New topic
Author

How to solve "Too many connections" error

rama ilango
Greenhorn

Joined: Dec 11, 2008
Posts: 24
Hi,

I connected the mysql database using java.When i access the multiple db connection at a time, the following error is occured

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1053)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2743)
at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at enspeed.rm.GlobalConnection.getConnection(GlobalConnection.java:27)
at enspeed.rm.CommonUtils.dateExpired(CommonUtils.java:145)
at enspeed.rm.HtmlHelperV2.PrintFooter(HtmlHelperV2.java:1914)
at enspeed.rm.LicenseAgreement.licenseDisp(LicenseAgreement.java:261)
at enspeed.rm.LicenseAgreement.processRequest(LicenseAgreement.java:141)
at enspeed.rm.LicenseAgreement.doGet(LicenseAgreement.java:409)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:517)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:595)
Common Utils : com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"

I properly closed all the connections.But the error is occured.How to solve it?
Reply please
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Apparently connections are not closed that properly as you seem to think.

How are you basically obtaining and closing connections? It should be like that:


The same way applies to (Prepared)Statement and ResultSet as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to solve "Too many connections" error