VistaDB 6
VistaDB / Developer's Guide / How To Perform Common Tasks / Use Connection Pooling / How To - Clearing Connection Pools
How To - Clearing Connection Pools

It is very important to clear the connection pools before application shutdown. Notice in the NUnit tests we call these methods to force releasing of all connection pools in several locations.

Clearing ALL Connection Pools

A static method exists that you may call in your application cleanup routines to ensure all pools are released.

Clearing All Connection Pools
Copy Code
// Release all the connection pools
VistaDBConnection.ClearAllPools(); 
Clearing All Connection Pools
Copy Code
' Call to release all connection pools
VistaDBConnection.ClearAllPools() 

Clearing a single connection pool

Perhaps you have a one time long running process that needs to use a connection pool. At the end of that run you may wish to clear the single connection pool to release those resources. The following example demonstrates how to clear a single pool.

Clear Single Connection Pool
Copy Code
string connectionString = "data source='c:\\temp\\database.vdb6'";
VistaDBConnection dbConn = new VistaDBConnection(connectionString);

// Clear JUST this one application pool - takes a VistaDBConnection object
VistaDBConnection.ClearPool(dbConn); 
Clear Single Connection Pool
Copy Code
Dim connectionString As String
connectionString = "data source='c:\\temp\\database.vdb6'"

dbConn As VistaDBConnection = New VistaDBConnection(connectionString)
'Clear JUST this one application pool - takes a VistaDBConnection object
VistaDBConnection.ClearPool(dbConn)