FK exception keeps db3 file open

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
adrian.petrescu
Posts: 3
Joined: Fri 08 Jun 2012 16:11

FK exception keeps db3 file open

Post by adrian.petrescu » Fri 08 Jun 2012 16:36

Hi,
I'm encountering a problem where after I get a FK constraint exception, after I execute connection.Close(), the db3 file remains open in the process (pooling is disabled). I've managed to reproduce this with other exception types as well.
I can see this problem both while using Devart ADO.NET connection or Entity Framework.

I really need to close the file because the app involves moving db3 files around. Any quick fix or workaround for doing this?

Thanks,
Adrian

adrian.petrescu
Posts: 3
Joined: Fri 08 Jun 2012 16:11

Re: FK exception keeps db3 file open

Post by adrian.petrescu » Wed 13 Jun 2012 10:34

This is how I can reproduce the problem:

Code: Select all

string connString = "Data Source=C:\\Temp\\TestDb\\TestDbEf.db; Pooling=False;";
SQLiteConnection conn = new SQLiteConnection( connString );
conn.Open();

try
{
	SQLiteCommand cmd = new SQLiteCommand( "INSERT INTO TestTable VALUES (5, 'hello')", conn );
	cmd.ExecuteNonQuery();

	//the next command throws exception because of uniqueness constraint violation
	cmd = new SQLiteCommand( "INSERT INTO TestTable VALUES (5, 'hello')", conn );
	cmd.ExecuteNonQuery();
}
catch( SQLiteException e )
{
	//do nothing
}
finally
{
	conn.Close();
}

try
{
	//deletion fails, file still held open;
        //if I comment out the second insert, deletion succeeds
	File.Delete( "C:\\Temp\\TestDb\\TestDbEf.db" );
}
catch( Exception e )
{
	Console.WriteLine( e.Message );
}
Any thoughts?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: FK exception keeps db3 file open

Post by Pinturiccio » Thu 14 Jun 2012 07:31

We have reproduced and fixed the bug with locking the database file after a database exception occurs. We will notify you when the corresponding build of dotConnect for SQLite is available for download.

adrian.petrescu
Posts: 3
Joined: Fri 08 Jun 2012 16:11

Re: FK exception keeps db3 file open

Post by adrian.petrescu » Mon 18 Jun 2012 13:53

Thank you for fixing it.
So can you give an estimation to when it's going to be available?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: FK exception keeps db3 file open

Post by Pinturiccio » Tue 19 Jun 2012 09:25

We are planning to release the next public build of dotConnect for SQLite at the end of the week.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: FK exception keeps db3 file open

Post by Pinturiccio » Thu 21 Jun 2012 13:22

The new build of dotConnect for SQLite 4.0.25 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/sqlite/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=24362

Post Reply