I've sended last month an example of servlet for accessing database; so here it is again. Problems I've go is : - I'm not concerned about number of users ( history - but it's another story developped later ) but I'm rather concerned about concurrent access. The idea developped in the source is to have a pool of database connection. This servlet is called by other servlet retrieving parameters and passing it : RequestDispatcher dispatch = getServletContext().getRequestDispatcher( SqlServlet + "?File=" + Mess1 + Mess2 + Mess4 ); dispatch.include(req, res); - So, servlet connecting to database process its pool of connection, execute statements ( sql orders are stored in files, with keywords for parameters ), and returns results. - Meanwhile, if a user cancel it's query, servlet goes on ..., until finished. I do not process here DELETE messages. So, if the same TCP adress comes again, it gets the same database connection and waits until the first query finish ( bad, bad, bad ...). - Source code is Serv3do3.java Otherwise, for counting number of access, I use the MaintainedServlet ( from bibli ), that I picked somewhere. It works with ServletMaintenance, and for storing value, I use TextCounter and TextCounterDatabase. All of those were developped by Matt Tucker, at CoolServlets.com - I modified for my own needs - have a look there, they might have some more good ideas. My servlet using those is called CSTextCounter, once more called by another servlet, and once more modified for internationalization. Have fun - j Brax
This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:34 GMT