I am calling my db connection method inside every single thread (using ExecutorService for fixed thread pooling) but if I am not using syncrhonized on the getConnection method then it is giving me error that
the connection has been closed
I am new to multi-threading so I read the Oracle document for DriverManager.getConnection() and it says that
"The DriverManager.getConnection() method returns a new Java Connection object every time you call it. Note that although the method is not creating a new physical connection (only a single implicit connection is used), it is returning a new object."
If I am already passing new Connection object in each worker thread then how come connection is getting closed.