• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySql Lost connection exception under load

 
John Toledo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
John Toledo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Toledo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic