I am using Postgresql(9.6.3) and I need to set value for Wait_timeout variable. But I don't find any answers related to that or any equivalent variables that can be used in Postgresql instead of wait_timeout variable in MySQL.
long wait_time = 0;
ResultSet rs = null;
try {
Statement st = con.createStatement();
rs = st.executeQuery("show variables like 'wait_timeout'");
if(rs.next())
wait_time = rs.getLong("Value");
rs.close();
} catch (SQLException e) {
logger.error(e);
}
// wait time in SQl is maintained in seconds whereas here we need
milliseconds
return (wait_time*1000)/2;
I am getting null value in resultSet variable after executing the query. I have found a variable called Statement_timeout but I don't know whether, it is equivalent for it or not, as it may affect all other sessions where as wait_timeout in MySQL does not. Please suggest me a better solution. Thanks in advance.