Basically, every object that handles Connection
and related resources must be initialized in the narrowest scope. Apart of this, you're naively and badly applying singleton for your DBManager
which will be used among several threads because multiple requests are served by a single servlet instance (more info on this: How do servlets work? Instantiation, sessions, shared variables and multithreading).
The best option would be removing the singleton (anti) pattern from your DBManager
class and make sure to initialize DBManager
in the narrowest scope where the database resources should be handled.