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:
rogan.dawes
2007-07-10 11:46:17 +00:00
parent 6f5e7c37f7
commit 5f67544b24
2 changed files with 15 additions and 1 deletions

View File

@ -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