Hello,
I am using a ajax autocomplete component from
http://www.dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-list. My problem is that i get a SQL error if the ajax component calls the
servlet faster than it can handle. The error is:
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after statement closed.
Let�s say the number of letters to be entered is 3 before a servlet lookup is performed. If the user enters 3 letters ('pet') it works fine. But if the user enters 4 letters (too fast) the ajax component calls the servlet twice ('pet') and ('pete'), and an error occurs.
I can avoid the the above error by doing the servlet synchronized, but is that a good solution? Any other ways to solve the problem?
public synchronized void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
}
Thanks in advance.
[ January 02, 2009: Message edited by: Jeppe Sommer ]
[ January 02, 2009: Message edited by: Jeppe Sommer ]