Results 1 to 4 of 4

Thread: Help needed

  1. #1
    amirsydney is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Question Help needed

    Im getting the below error message with MySql connectivity. Please someone help me..

    Note: My Java Program could connect to the database and function properly. It fetches data for the first time, after few tries I'm getting this error.

    Below is the Error message:

    com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:40 9)
    at com.mysql.jdbc.SQLError.createCommunicationsExcept ion(SQLError.java:1118)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(Co nnectionImpl.java:2308)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(Connecti onImpl.java:2122)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImp l.java:774)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connect ion.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:40 9)
    at com.mysql.jdbc.ConnectionImpl.getInstance(Connecti onImpl.java:375)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:289)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at rbt.ResourceListMaker.getResource(ResourceListMake r.java:14)
    at org.apache.jsp.Resource_jsp._jspService(Resource_j sp.java:95)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:729)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:308)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:259)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:729)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:879)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.net.SocketException: No buffer space available (maximum connections reached?): connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292)
    ... 35 more
    Exception: Communications link failure

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    "No buffer space available (maximum connections reached?)"

    Are you closing your connections?

  3. #3
    amirsydney is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default

    I am closing the connection in a finally block as below:

    finally {
    try {
    if(con != null)
    con.close();
    }
    catch(SQLException e) {}
    }

    But still having this problem. Anything else to check?? Any suggestion appreciated...

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    And you do that everywhere you use a connection?

    i don't know if MySQL has a table you can look at to see the number of active connections.
    If so you could monitor that.

Similar Threads

  1. Help Needed
    By 7auz in forum Eclipse
    Replies: 1
    Last Post: 09-30-2010, 05:59 PM
  2. help needed
    By silversurfer2in in forum JDBC
    Replies: 3
    Last Post: 05-29-2010, 03:16 PM
  3. Help needed
    By saibru in forum CLDC and MIDP
    Replies: 0
    Last Post: 03-23-2009, 09:40 AM
  4. help needed!!! :S
    By mark-mlt in forum Networking
    Replies: 1
    Last Post: 04-14-2008, 09:27 AM
  5. help needed.
    By dirtycash in forum New To Java
    Replies: 3
    Last Post: 12-03-2007, 09:17 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •