Results 1 to 3 of 3
  1. #1
    gane is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default MySQL connection via Hibernate is timed out frequently

    I am connecting to MySql using Hibernate and every 8 hours the connection is timed out. I am getting com.mysql.jdbc.exceptions.jdbc4.CommunicationsExce ption. It also display very big error message. "The last packet successfully received from the server was 437,036,648 milliseconds ago......."

    If i restart my application, things will work fine. Please help me out.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    are you using a database connection pool, such as commons-pool.
    they support a "test on borrow" mechanism where the connection in the pool is tested with a "validation query" before it is given to the requesting application. This facility works to remove these sql error messages from the application, as it opens the connection again as needed.
    see also: DBCP - Commons Wiki
    but i;m sure other connection pool implementations support something like test on borrow and validation query as well

  3. #3
    nandak is offline Member
    Join Date
    Dec 2010
    Posts
    3
    Rep Power
    0

    Default

    The issue is due to your connection pool library timing out the database connection. You need to test or validate it. Check out the article to set the relevant properties in c3p0 file.

Similar Threads

  1. javamail, Connection timed out
    By OmerHalit in forum Networking
    Replies: 11
    Last Post: 04-12-2010, 07:02 AM
  2. Connection Timed Out
    By sukatoa in forum Networking
    Replies: 2
    Last Post: 10-27-2009, 03:20 PM
  3. connection timed out in my java code
    By santhosh_el in forum AWT / Swing
    Replies: 4
    Last Post: 10-22-2009, 12:24 PM
  4. solution for connection timed out
    By santhosh_el in forum Networking
    Replies: 0
    Last Post: 10-03-2009, 07:55 AM
  5. i am getting connection timed out
    By santhosh_el in forum Networking
    Replies: 1
    Last Post: 08-25-2009, 06:57 AM

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
  •