I’ve found the following error in my application’s error log file.
“ERROR [org.sample.dao.hibernate.LoginDAOImpl] org.sample.dao.hibernate.LogonDAOImpl –
Exception Catched in [getHostIdFromDB] method : – IO Error: Socket closed”
The following is a snippet of getting a value from the database.
try {
session = getHibernateTemplate().getSessionFactory().openSession();
conn = session.connection();
stmt = conn.createStatement();
stmt.execute("select GLOBAL_VAR.FN_GET_HOST from dual");
rs = stmt.getResultSet();
rs.next();
sysdate = (String) rs.getObject(1);
log.debug(this.getClass().getName() + " - [getHostIdFromDB] - Exit");
return sysdate;
} catch (Exception exp) {
log.error(this.getClass().getName() + " - Exception caught in [getHostIdFromDB] "
+ exp.getMessage());
}
As this error is logged once in the error log file I can guess this could be some network connection problem. But I want to know more about this error(IO Error: Socket closed”) and it’s root cause. Any clarifications would be appreciable.
The connection time out could be because of a Driver/DB issue or because the result is too long to be read or the query is taking lot of time to execute . Try moving to a pooled connection C3p0 and see if you get better results .