Forums Register Login

com.mysql.jdbc.CommunicationsException

+Pie Number of slices to send: Send
I am using mysql database with a Hibernate application. Sometimes it works , but sometime, it throws following exception



What is the reason behind this?
+Pie Number of slices to send: Send
strange sometimes work , sometimes doesnt ??

few questions for you
  • are you facing a similar issue when trying to to connect to the DataBase using a query browser ? ( like sql developer for oracle or Toad ?? ) if yes its sporadic some network error
  • if NOT , try to change your connection properties server name with ip address etc (ex : localhost with the ip address i,e 127.0.0.1 or computer name)
  • +Pie Number of slices to send: Send
    Thanks for your reply
    When i login through console or phpadmin, it opens successfully

    I need to change the connection properties in my hibernate cfg.xml?
    +Pie Number of slices to send: Send
    yes, try changing the server name to ip address ( or vice versa )
    also, does PHPAdmin always works ??
    +Pie Number of slices to send: Send
    Yes, phpmyadmin always works

    This is the change i have done
    <property name="connection.url">jdbc:mysql://127.0.0.1:3306/smartlife</property>

    But it gives the same exception

    Is my url correct?

    +Pie Number of slices to send: Send
    possibly last thing i can think of is
    * may be a firewall issue
    * may be you can try changing the port of MySQL ( as of now you are using default 3306)
    +Pie Number of slices to send: Send
    Thanks for your reply lavnish lalchandani
    Trying changing the port
    +Pie Number of slices to send: Send
    Sorry for late response, but, now, i have found out, when this error occurs.
    I am using mysql as the db.

    Here is my hibernate.cfg.xml


    My database name is "smart". Now, when i open the mysql console, it asks for password, which by default is null. I press enter, and then use this command. "use smarts"
    It gets me to smarts db.

    The problem is that, when i have started all services of "WAMPSERVER", (regardless of mysql console) the error never occurs. Only when there is no WAMPSERVER working, the error occurs.
    Also, when i type "127.0.0.1" in browser, it opens the WampServer. Same is the case when i type "localhost" in the browser and press enter. Is that something i need to notice?
    Should i go for separate ,mysql installation?
    What is the problem, and how can i solve it?
    All of life is a contant education - Eleanor Roosevelt. Tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 2572 times.
    Similar Threads
    url recorder
    connection to remote mysql db
    java.net.ConnectException: Connection refused: connect
    Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
    MySQL 4.1 [java.net.ConnectException: Connection refused]
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Apr 16, 2024 09:30:42.