This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Communication link failure: java.net.SocketException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Communication link failure: java.net.SocketException" Watch "Communication link failure: java.net.SocketException" New topic
Author

Communication link failure: java.net.SocketException

Tony May
Greenhorn

Joined: Jan 04, 2002
Posts: 17
Dear All,
Hope someone can help as I'm completely stuck. I am using the Struts framework and am configuring a org.apache.commons.dbcp.BasicDataSource as a connection pool connecting to mySQL 3.23 database.
Everything is fine for a day or so and then I get the following error when trying to access the database -
java.sql.SQLException: Communication link failure: java.net.SocketException
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:882)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:917)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1806)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1740)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1220)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)

I am using mySQL-connector-java 3.0.6 drivers and I think I am closing all my connections correctly. What is going wrong ?
Tony May
Greenhorn

Joined: Jan 04, 2002
Posts: 17
Solved it -
The driver kills connections after 8 hours. I wasn't using the autoReconnect=true parameter which should solve the problem.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521

Moving to the JDBC forum - so that others may share the benefit of your experience .


"JavaRanch, where the deer and the Certified play" - David O'Meara
Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140
I'm using the DBPool package with a MySQL db under Struts and Tomcat 4.1
with the following settings in the properties file:
drivers=org.gjt.mm.mysql.Driver
logfile=dblog.txt
local.url=jdbc:mysql:/localhost/billblac_recovery
local.user=billblac_bill
local.password=wgb
local.maxpool=20
local.maxconn=20
local.expiry=0
local.name=recovery
local.debug=true
I'm getting the following error message intermittently on the host's linux
server. I don't get the error on my Win2000 desktop under
development:
UserFactory.searchReturn() - EXECUTING STATEMENT
UserBeanCommandFactory.searchReturn() sqlException: Communication link
failure: java.net.SocketException
java.sql.SQLException: Communication link failure: java.net.SocketException
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:882)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1809)
at
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
at
snaq.db.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:55
)
at com.recovery.factories.UserFactory.searchReturn(Unknown Source)
at com.recovery.actions.LogInAction.execute(Unknown Source)
The error always occurs after about 10 minutes has gone by since the last
connection to the DB has been made. I have to restart
Tomcat on the server to clear it all up. I'm at a loss here and any ideas
would be greatly appreciated!
Also, where does the dblog.txt file go? In the same directory as the
properties file? I am not getting any debug info into the file.
Thanks,
Vikas Aggarwal


Vikas Aggarwal

Founder @
Leads and Deals Limited

www.LeadsAndDeals.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communication link failure: java.net.SocketException
 
Similar Threads
Broken pipe Error
connection reset on MySQL and Resin-3.0.13
Snaq DBPool, Mysql Communication Link Failure
Communications link failure in JBOSS
JDBC Timeout issue with MySQL