Add mechanism to close DB connections
Oracle ends up refusing connections if we don't close them git-svn-id: http://webgoat.googlecode.com/svn/trunk@128 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
@ -308,7 +308,7 @@ public class WebSession
|
||||
public static synchronized Connection getConnection(WebSession s)
|
||||
throws SQLException, ClassNotFoundException
|
||||
{
|
||||
if ( connection == null )
|
||||
if ( connection == null || connection.isClosed() )
|
||||
{
|
||||
connection = DatabaseUtilities.makeConnection( s );
|
||||
}
|
||||
@ -316,6 +316,13 @@ public class WebSession
|
||||
return connection;
|
||||
}
|
||||
|
||||
public static synchronized void closeConnection() throws SQLException
|
||||
{
|
||||
if (connection != null && !connection.isClosed()) {
|
||||
connection.close();
|
||||
connection = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
|
Reference in New Issue
Block a user