I wrote a simple Servlet that connects to the DB, retrieves some info end writes a json response. I 'm using tomcat.
Just a couple of question about servlets:
1) As far as I understood the container, if receives simultaneous requests, puts them in a queue and in the end only one Servlet at time is executed, is that true? or the container parallelize the requests using different Servlets instances?
2) In order to connect to the DB,I create the connection in another Class that implements ServletContextListener in the contextInitialized and close it in the contextDestroyed. Is that the correct way? If I want to parallelize should I use different connections , correct?