My
application with the ThinkGeo WPF Map Control and an OSM SQLite database
crashes when multiple users share and access the same database and
tiles. There is no problem with a single user.
As I know, multiple processes can have the same SQLite database open
at the same time, several read accesses can be satisfied in parallel.
I
use a SQLite connection string with the read only flag set to true(Version=3;Read
Only=True;)
I'm getting the "locking protocol" Error on:
at
System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql,
SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
at
System.Data.SQLite.SQLiteCommand.BuildNextCommand()
at
System.Data.SQLite.SQLiteDataReader.NextResult()
at
System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior
behave)
at
System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at IRMapModel.IRMapMgr.GetFeaturesBySegmentRSID(String[] rsids)
The
following is the GetFeaturesBySegmentRSID(String[] rsids) function which fails:
public static Collection<Feature>
GetFeaturesBySegmentRSID(string[] rsids)
{
if (rsids == null || rsids.Length == 0)
return null;
SqliteFeatureSource segmSource =
(SqliteFeatureSource)NavData.LayerIRRoads.FeatureSource;
string query = "Select " +
NavData.fldXREFfeatid + " From " + NavData.NAVMAKER_SEGMENT_XREF +
" Where " +
NavData.fldXREFrsid + " = ";
Collection<Feature> segmFeatures = new
Collection<Feature>();
if (NavData.LayerIRRoads.IsOpen == false)
NavData.LayerIRRoads.Open();
using (System.Data.SQLite.SQLiteConnection
conn = new System.Data.SQLite.SQLiteConnection(segmSource.ConnectionString))
{
conn.Open();
foreach (string rsid in rsids)
{
using
(System.Data.SQLite.SQLiteCommand sqlComm = new
System.Data.SQLite.SQLiteCommand(query + rsid, conn))
{
System.Data.SQLite.SQLiteDataReader r = sqlComm.ExecuteReader();
if
(r.Read() == true)
{
string fid = (string)r[NavData.fldXREFfeatid].ToString();
Feature feat =
NavData.LayerIRRoads.QueryTools.GetFeatureById(fid, NavData.segmColumns);
segmFeatures.Add(feat);
}
}
}
conn.Close();
}
return segmFeatures;
}
Any
idea?
Do
you know if I there are any specific SQLite database or connection settings
which could solve this problem?
Thanks,
Gene