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 MySql Lost connection exception under load 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 "MySql Lost connection exception under load" Watch "MySql Lost connection exception under load" New topic
Author

MySql Lost connection exception under load

John Toledo
Greenhorn

Joined: Sep 06, 2003
Posts: 3
Has anyone ever encountered a problem where JBoss begins to through exceptions under load. Basically, I have a MySql database. I can connect to it, query and update it just find. I have about 6,000 records in the database. Here is the basic loop.
con = DBUtil.getConnection();
ps = con.prepareStatement(query);
rs = ps.executeQuery();
boolean hasPatients = rs.next();
if (hasPatients)
{
do
{
myDataObj.setLocation(rs.getString("LOCATION"));
.
.
.
while (rs.getnext());
myArray.add(myDataObj)
}
I return the array and the JSP loops through the array and displays the information. It works fine when there are only 100 or so records in the result set. If I set the query statemt to something like "select * from table" it runs for a few seconds and then I start to get the following message in the JBoss command windows:
13:42:57,685 INFO [STDOUT] SqlError encountered; couldn't close connection obje
ct.java.lang.NullPointerException
13:42:57,685 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is
there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
If I let the application just sit for a while I can query again (with something other then "select *").
MySql is up and running. Like I said it only happens when I try to retrieve a large result set. If there are limit to the resultset?
Any help would be appreciated.
JT


JT
John Toledo
Greenhorn

Joined: Sep 06, 2003
Posts: 3
I ran some more test and have some more information that may help someone that knows about this. There are 5727 records and when the list does display it displays all of the records. I still have tons of exception messages though. Some of the errors mention that a field that I am trying to retrieve is in use and others that the connection may be lost. So many messages scroll by that I don't have them all.
Any ideas anybody?
14:01:17,547 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
14:01:17,547 INFO [STDOUT] SqlError encountered; couldn't close connection object.java.lang.NullPointerException
14:01:17,547 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
14:01:17,547 INFO [STDOUT] SqlError encountered; couldn't close connection object.java.lang.NullPointerException
14:01:17,547 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
14:01:17,557 INFO [STDOUT] SqlError encountered; couldn't close connection object.java.lang.NullPointerException
14:01:17,557 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
14:01:17,557 INFO [STDOUT] SqlError encountered; couldn't close connection object.java.lang.NullPointerException
14:01:17,557 INFO [STDOUT] Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to?
(java.net.BindException)
14:01:17,557 INFO [STDOUT] SqlError encountered; couldn't close connection object.java.lang.NullPointerException
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
It almost seems like this problem might be on the MySQL server side, rather than in your JBoss environment. Check the documentation for the version and mode of MySQL that you are running and see if you need to tune it differently for larger queries.
WARNING: this was just a guess.


Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
John Toledo
Greenhorn

Joined: Sep 06, 2003
Posts: 3
Thanks! I'll look into that. In the mean time I restructured some things so that I can load as little as possible and that seems to have alleviated the problem but you're right. 6,000 records isn't all that much of a load and shouldn't be causing a problem.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Under much greater loads than what you seem to be using, I have had problems using MySQL. We set the MySQL server process to a higher priority and had much greater success, but we were still able to cause a failure if we hit it hard enough.
The problem was much as you described. We were disappointed.
So, apparently I'm not really offering any help - just sympathy.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySql Lost connection exception under load
 
Similar Threads
Running application on web start
EJB deployment error
JNDI error message
P6spy does not create spy.log for stand-alone Java program
3 days stucked - NullPointer Persistent Unit no Caused By