Other applications can no longer read database

Started by emibel

Other applications can no longer read database   28 January 2013, 17:37

Somewhere between versions 5.2.1 and 5.2.6, the Networx database has become locked so that other applications can't read it. I have a VB.NET program which used to read the database under version 5.2.1, but I hadn't used the facility for some time. Recently, I decide to re-activate the code using the latest version (5.2.7) and found that I could no longer read the database because it was locked. I also tried 5.2.6 with the same result.

I can't see anything in the change log about this. Was the change accidental or intentional?

I'm using Windows 7 x64, with Visual Studio 2010.
SoftPerfect Support forum - Andrew avatar image

Other applications can no longer read database   28 January 2013, 19:25

Since version 5.2.3 the database mode has changed from a rollback journal to WAL (this wasn't mentioned in the change log).

Older versions of SQLite access libraries may not be able read a WAL-mode database.

I suggest that you download a copy of SQLiteSpy.

If it opens the database OK and reads the tables, then it means the database is fine and you may need to update your VB.NET access library so that it can read a WAL-mode database.

Other applications can no longer read database   28 January 2013, 21:09

OK thanks. I'll give that a go.

Other applications can no longer read database   29 January 2013, 20:31

I tried SQLiteSpy, and that opens the database OK, so I downloaded the latest version of System.Data.SQLite (64-bit, .NET 4.0) from here:

http://system.data.sqlite.org/downloads/1.0.84.0/sqlite-netFx40-setup-x64-2010-1.0.84.0.exe

and installed it:

I then copied the files System.Data.SQLite.dll and System.Data.Interop.dll (and their corresponding .pdb files) into the binary folder of my VB project, replacing the versions that were there before. I then re-installed Networx 5.2.7. However, I still get the same error when executing my code, the salient part of which is shown below:
    Dim myConnection As New SQLiteConnection("Data Source=" & NetWorxDatabase)
    Dim myDataAdapter As New SQLiteDataAdapter("select * from usage where day >= " & New DateTime(Today.Year, Today.Month, 1).ToOADate & _
                                               " order by day, hour", myConnection)
    Dim myDataTable As New DataTable

    myDataAdapter.Fill(myDataTable)

The code throws the following exception on the .Fill, indicating that the database is locked.
System.Data.SQLite.SQLiteException was unhandled
  ErrorCode (ExternalException)=-2147467259
  Message=The database file is locked
database is locked
  Source=System.Data.SQLite
  StackTrace:
       at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLite3.cs:line 199
       at System.Data.SQLite.SQLiteDataReader.NextResult() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteDataReader.cs:line 902
       at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteDataReader.cs:line 85
       at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteCommand.cs:line 536
       at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteCommand.cs:line 565
       at System.Data.SQLite.SQLiteConnection.Open() in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteConnection.cs:line 932
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       at MyUsageMeter.MyUsageMeterMod.GetNetworxData() in D:\My Documents\VB\MyUsageMeter\MyUsageMeterMod.vb:line 11723
       at MyUsageMeter.MyUsageMeterBar.EverySecond() in D:\My Documents\VB\MyUsageMeter\MyUsageMeterBar.vb:line 2793
       at MyUsageMeter.MyUsageMeterBar.TimerNetwork_Tick(Object sender, EventArgs e) in D:\My Documents\VB\MyUsageMeter\MyUsageMeterBar.vb:line 4379
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at MyUsageMeter.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

  ******   **     **   *******   **     **  **    ** 
 **    **   **   **   **     **  **     **   **  **  
 **          ** **           **  **     **    ****   
 **           ***      *******   **     **     **    
 **          ** **           **  **     **     **    
 **    **   **   **   **     **  **     **     **    
  ******   **     **   *******    *******      **    

Message: