List:General Discussion« Previous MessageNext Message »
From:Brevsville Administrator Date:June 13 2000 9:11am
Subject:Re: connection problem with mySQL from servlet
View as plain text  
At a quick look It seems to me you are not releasing your resources
correctly. Add

	if (stmt!=null)
               	stmt.close();

After the query has been executed

ie:

    try{
      stmt = dbCon.createStatement();
      stmt.executeUpdate(qry);

    }
    catch(SQLException e) {
      _res.sendError(_res.SC_ACCEPTED, "The request has been accepted, but
it failed to 	complete due to a problem querying the database.");
      return;
    }

	if (stmt!=null)
               	stmt.close();

JServ is probably running out of resource connections to the database.

hth 

Chris

On Mon, 12 Jun 2000 20:45:01 CST6DST, Sa wrote:

>Hi, 
>
>I have a online register form and and I used servlet to insert info into MySQL 
>database. When I fill the form the first time, it works fine and it can be 
>properly inserted into database. However, when I fill the form the second time, 
>I got the following error:
>"Accepted
>The server encountered an internal error or misconfiguration and was unable to 
>complete your request.
>More information about this error may be available in the server error log."
>
>I checked the log file and it showed:(ERROR) ajp12: Servlet Error: The request 
>has been accepted, but it failed to complete due to a problem querying the 
>database.
>
>If I stop the server and restart the server, then it works again. But one more 
>time, I got the error again. I don't know if it's due to the servlet code or due 
>to some misconfiguration of my apache server or Apache JServ or mySQL. Also, I 
>don't know why I can't use "doPost()" method, but only "doGet()" method. Can 
>someone give me any clue? Thanks!
>
>P.S. I attached the servlet code (adduser1.java) with this email.
>
>Sa


Thread
sql_select.cc divide by zero (patch incl.)Thimble Smith2 Apr
  • sql_select.cc divide by zero (patch incl.)Michael Widenius2 Apr
  • Re: connection problem with mySQL from servletMichael Yuan13 Jun
  • Re: connection problem with mySQL from servletBrevsville Administrator13 Jun
  • Re: connection problem with mySQL from servletCLAUDE LEBLANC13 Jun