I am getting a Oracle JDBC connection from a connection pool using a data source object. And using the connection to insert some logs into DB from java (via java static method). Since there will be around 10 to 20 inserts per user, what I am doing is, I am commiting the connection at request level in Filter and closing the connection at session level (via Session Listener's sessionDestroyed() method) I did not get any error in testing but in production environment, I am getting few error as follows,
java.sql.SQLException: execute, Exception = null (one scenario)
java.sql.SQLException: close, Exception = null (for another scenario)
How to avoid these errors? Can I instead commit and close the connection in java static method, instead of commiting at request level and closing at session level?
But what amuses me is that, those errors are occuring inspite of having the below logic in my java static method,
if (con.isClosed() || con == null) {
DBConnectionHelper connHelper = DBConnectionHelper.createInstance();
con=connHelper.getConnection("ds");
con.setAutoCommit(false);
}
So I am checking for the above, and so there is no way connection can be closed when I am trying for execute, am I right? But not sure and confused why its occuring.
close()call and instead return the connection to the pool.conpoint to?