On 27-6-2014 18:09, Scott Morgan wrote:
> Trying to drop a DB opened with the embedded system, but something seems
> to be holding the file open after the connection is closed.
>
> Test case from a console app:
>
> Console.WriteLine("Attempting to open DB...");
> var conn = new FbConnection();
> conn.ConnectionString = myConnectionString;
> conn.Open();
>
> Console.WriteLine("Attempting to close DB...");
> conn.Close();
>
> conn = null;
> GC.Collect(); // Getting desperate here
>
> Console.WriteLine("Attempting to delete DB...");
> FbConnection.DropDatabase(ConnectionString);
> // File.Delete(DBPath); // doesn't work either

The .net provider has a connection pool, so the physical connection is 
still open. You need to flush the pool, or disable connection pooling.

You can flush the pool with:
FbConnection.ClearAllPools();

and disable connection pooling by setting Pooling=false in the 
connection string.

Mark
-- 
Mark Rotteveel

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to