Add check for closed connections in DbConnection.isValid()
This commit is contained in:
parent
0227e1bce6
commit
dece309fce
1 changed files with 3 additions and 3 deletions
|
@ -40,11 +40,11 @@ public class DbConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid(int id) {
|
public boolean isValid(int id) {
|
||||||
if (id != serialId) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// test if connection is still ok
|
// test if connection is still ok
|
||||||
try {
|
try {
|
||||||
|
if (id != serialId || connection.isClosed()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.execute("SELECT 1");
|
stmt.execute("SELECT 1");
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue