Hi Everyone,
Can any one help on this:
JDK: 1.8
JDBC
<artifactId>jdbc</artifactId>
<version>5.5.30.Final</version>
I am trying to set limit to the execution of the query for 5 seconds.
I tried with the below code. I didnot work .
Expected :
When i run the query which take 5 second to execute. should close the process and throw the exception.
public NamedParameterJdbcTemplate getJdbcTemplate() {
if (null == jdbcTemplate) {
Properties test = new Properties();
test.setProperty(OracleConnection.CONNECTION_PROPERTY_THIN_READ_TIMEOUT, "5000");
JdbcTemplate temp1= null;
try {
testDataSource.setConnectionProperties(test);
temp1 = new JdbcTemplate(testDataSource);
temp1.setQueryTimeout(1);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
jdbcTemplate = new NamedParameterJdbcTemplate(temp1);
}
return jdbcTemplate;
}
Thanks,
Dimosh