Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Posted by: Andreas T.
Date: April 26, 2010 07:39AM

I had a similar problem with this configuration:

System: ubuntu server 2.6.24-19
MySQL: 5.0.51a-3ubuntu5.1
Apache Tomcat: 5.5.28
JVM: 1.6.0_18-b07

I tried with 'autoReconnect=true' but it didn't work.
I tried with bind-address = 127.0.0.1 within /etc/mysql/my.cnf file but it didn't work.

I solved it using the validationQuery property within the context.xml of my webApp:

<Context path="/test">
<Resource name="jdbc/testdb"
type="javax.sql.DataSource"
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1/mydb"
username="#######"
password="#######"
validationQuery="select now()"
maxWait="1000"
removeAbandoned="true"
maxActive="8"
maxIdle="4"
removeAbandonedTimeout="60"
logAbandoned="true"/>
</Context>

I hope this can help you.

Options: ReplyQuote


Subject
Written By
Posted
Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
April 26, 2010 07:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.