Can we set Query timeout globally (i.e. in DataSource configure, spring application properties file or somewhere).As i have to write everywhere in my project in which Statement / PreparedStatement used.
I have seen only two ways to set query timeout yet. But it works only one preparedStatement/statement at a time. see below code.
preparedStatement.setQueryTimeout(30); or PoolUtilities.setQueryTimeout(preparedStatement, 30);
I could not found any solution for this. Please let me know if you know to set simple jdbc query timeout on global level
You can use
CONNECTION_PROPERTY_THIN_READ_TIMEOUT
for Oracle thin driver. Add to datasource as follows