Re: Connector/J "Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost."
Posted by: david s
Date: February 20, 2008 06:05PM

Dear Mark,

This problem has been occurring for us at a client's location for a couple of months. The worst manifestations were Apache log files larger than 10 megabytes, and the client's need to restart Apache Tomcat every few days. We have five Java timers that run every minute on the database, so there are a lot of attempted connections to MySQL.

My client's implementation should not be any different than the setup that I have on my own computer. After trying several alternatives, I decided to compare their my.ini file to mine.

I discovered that there was an extra line in their file which was:



After I commented the line, the exceptions and problems in the Tomcat log went away (after restarting the appropriate services). I'm not sure why this line was there, it may have to do with the php server that we set up for the client. I think it was manually entered, and not part of the preparation done by the MySQL configuration wizard.

This a slightly expanded section of code showing where in the file the specific line was located:

# ----------------------------------------------------------------------
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.

# The TCP/IP Port the MySQL Server will listen on

I hope this helps you and the others resolve your problems.

Options: ReplyQuote

Written By
Re: Connector/J "Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost."
February 20, 2008 06:05PM

Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.