Hello All
I have made a service which connects to jdbc:microsoft:sqlserver and Process some tasks.
The service connects to database after every 10 min and process my code.All goes well.
But If the service is kept running for say 24 hrs it gives me error
[ [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error]
The error is random means it not coming everytime.
I have checked the logs also, the server wasn't down.
I am trying with the validationQuery setting
private Connection getDBConn() throws SQLException, ClassNotFoundException {
Connection conn;
Class.forName(driver);
if ((dbName != null) && (!dbName.equals(""))) {
connectionURL = connectionURL + ";DatabaseName=" + dbName;
} else {
connectionURL = connectionURL + ";DatabaseName=master";
}
connectionURL.concat("?validationQuery=String 1");
logger.debug("Establishing Connection: " + connectionURL);
conn = DriverManager.getConnection(connectionURL, username, password);
return conn;
}
is this correct ?
Please suggest.