Bug 6062 - Mono.Data.Sqlite.SqliteException: The database file is locked unable to close due to unfinalised statements
Summary: Mono.Data.Sqlite.SqliteException: The database file is locked unable to close...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Data.Sqlite ()
Version: 2.10.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-07-10 12:53 UTC by Amanda
Modified: 2013-06-21 09:59 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

My installed versions (73.16 KB, image/png)
2012-07-10 12:53 UTC, Amanda

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 6062 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Amanda 2012-07-10 12:53:38 UTC
Created attachment 2183 [details]
My installed versions

After this code:

 var documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
			string dbname = "Splatta.db";
        string db = Path.Combine (documents, dbname);  
        bool exists = File.Exists (db);  
        if (!exists)  
            SqliteConnection.CreateFile (db);  
        var conn = new SqliteConnection("Data Source=" + db);

        if (!exists) {  
            var commands = new[] {   
            "CREATE TABLE if not exists Person (ID   INTEGER PRIMARY KEY , Name ntext, Cell ntext,TwitterName ntext,BlogUrl ntext )", 
					"CREATE TABLE if not exists PersonRating (ID  INTEGER PRIMARY KEY , PersonID INTEGER NOT NULL, CategoryID INTEGER  NULL, RatingID INTEGER  NULL, Comments ntext, StarRate INTEGER)",

            foreach (var cmd in commands)  
                using (var c = conn.CreateCommand()) {  
                    c.CommandText = cmd;  
                    c.CommandType = CommandType.Text;  
                    conn.Open ();  
                    c.ExecuteNonQuery (); 

					conn.Close ();  

i get the following error sometimes when the database has been created the first time:

Mono.Data.Sqlite.SqliteException: The database file is locked
unable to close due to unfinalised statements
  at Mono.Data.Sqlite.SQLiteBase.CloseConnection (Mono.Data.Sqlite.SqliteConnectionHandle db) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs:212
  at Mono.Data.Sqlite.SqliteConnectionHandle.ReleaseHandle () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs:806