VistaDB 6
VistaDB.Provider Namespace / VistaDBConnection Class / ClearAllPools Method
Example


In This Topic
    ClearAllPools Method
    In This Topic
    Clear all connection pools for this embedded VistaDB engine (process).
    Syntax
    'Declaration
     
    
    Public Shared Sub ClearAllPools() 
    'Usage
     
    
    VistaDBConnection.ClearAllPools()
    public static void ClearAllPools()
    Remarks

    This will clear all pools of inactive connections (which are awaiting possible reuse) for all databases and open modes to ensure their file handles are all closed. This can be necessary (if pooling has been enabled) if an exclusive connection is needed such as in order to perform a PackDatabase operation.

    Note that this does not close currently "open" connections that have not been returned to the pool for reuse. Also note that pooling is managed by each embedded VistaDB engine (each process) and is not shared between processes, so it also does not close connections that could exist in other processes.

    Example
    using (VistaDBConnection conn = new VistaDBConnection(
            @"Open Mode=SingleProcessReadWrite;Pooling=true;Data Source=" + dbname) )
    {
        conn.Open();
                
        // Do some work...
    }
                
    // Immediately... or later...
                
    VistaDBConnection.ClearAllPools();
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also