I have a project performing some insert operations to data base.It works fine while processing single request.
But it throws " DSRA9110E: Connection is closed " error when it receives a bulk of requests.
I have two classes
1)DBConnection:To get the connection
2)DAOImpl: code to perform insert operations on DB
Below is my code for getting connection object.
DBConnection class:
public static Connection conn = null;
public static
String jndi="jdbc/servicedb"
public static Connection getConnection() {
try {
Context intialCtnx = new InitialContext();
DataSource ds = (DataSource) intialCtnx.lookup(jndi);
conn =ds.getConnection();
} catch (Exception e) {
--------
}
return conn;
}
DAOImpl class:
I get the connection from DBConnection class and perform insert operations on DB.
public static Connection connection = null;
connection = DBConnection.getConnection();
I am really confused to handle the scenario