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.
All Forums
> NetWorx
> Current topic
Other applications can no longer read database
Started by emibel
Other applications can no longer read database 28 January 2013, 17:37 |
Registered: 12 years ago Posts: 3 |
|
Other applications can no longer read database 28 January 2013, 19:25 |
Admin Registered: 19 years ago Posts: 3 600 |
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.
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 |
Registered: 12 years ago Posts: 3 |
Other applications can no longer read database 29 January 2013, 20:31 |
Registered: 12 years ago Posts: 3 |
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:
The code throws the following exception on the .Fill, indicating that the database is locked.
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: