The bug related to "Unable to open database file" exception when opening several connections in the LinqConnect for Metro edition was not fixed in 4.1.184 07-Feb-13 release. This code runs the first two times but after that it will give the "Unable to open database file". I am using direct calls because this is much faster than the linq to sql method when running in a transaction. I can load 100000 this way in minutes.
using (SQLiteConnection sqliteconnection = new SQLiteConnection("Data Source = database.db3; Version=3"))
{
sqliteconnection.Error += new SQLiteConnection.SQLiteErrorEventHandler(SQLiteError); ;
sqliteconnection.Open();
using (SQLiteTransaction sqlitetransaction = sqliteconnection.BeginTransaction())
{
SQLiteCommand command = sqliteconnection.CreateCommand();
try
{
command.CommandText = AttributeHelper.CreateInsertWithParameter<T1>(dc, ref command, add_items[0]);
command.Prepare();
foreach (var add_item in add_items)
{
AttributeHelper.SetParameters<T1>(dc, ref command, add_item);
command.ExecuteNonQuery();
sqlitetransaction.Commit();
}
catch
{
if (sqlitetransaction != null)
{
sqlitetransaction.Rollback();
}
}
if (sqliteconnection.State != ConnectionState.Closed)
{
sqliteconnection.Close();
if (sqliteconnection != null)
{
sqliteconnection.Dispose();
}
if (sqlitetransaction != null)
{
sqlitetransaction.Dispose();
}
if (command != null)
{
command.Dispose();
}
}
}
}
}
}
Unable to open database file
Re: Unable to open database file
These issues are not the same. The issue, you have reported, is related to working with transactions and configuration of the 'JournalMode' parameter of the connection string. We are working on this issue now and we will inform you about the results as soon as possible.
As a temporary workaround, please set the 'JournalMode' parameter of your connection string to 'Off'.
We also recommend you to use your connection string in the ways which are demonstrated in the "Database Deployment and Connection String Format" section at http://blogs.devart.com/dotconnect/linq ... guide.html
For example:
Please tell us if this helps.
As a temporary workaround, please set the 'JournalMode' parameter of your connection string to 'Off'.
We also recommend you to use your connection string in the ways which are demonstrated in the "Database Deployment and Connection String Format" section at http://blogs.devart.com/dotconnect/linq ... guide.html
For example:
Code: Select all
using (SQLiteConnection sqliteconnection = new SQLiteConnection("Data Source = ms-appdata:///local/database.db"))
{...}
Re: Unable to open database file
Thanks for the response, tried the solution given. Changed code to the following.
var dbPath = "ms-appdata:///local/supersuite.db3";
connectionString = string.Format("Data Source = {0}; Version= 3; Journal Mode=Off;", dbPath);
I still receive error "unable to open file" on third attempt.
var dbPath = "ms-appdata:///local/supersuite.db3";
connectionString = string.Format("Data Source = {0}; Version= 3; Journal Mode=Off;", dbPath);
I still receive error "unable to open file" on third attempt.
Re: Unable to open database file
A fix for issue "Unable to open file" for metro can be found here
http://briandunnington.blogspot.com/201 ... t-bug.html
http://briandunnington.blogspot.com/201 ... t-bug.html
Re: Unable to open database file
Thank you for your involvement. We will investigate the issue with the "Unable to open database file" exception and inform you about the results as soon as any are available.
Re: Unable to open database file
The bug related to the "Unable to open database file" with different variants of JournalMode in Metro style applications is fixed.
The latest build of LinqConect for Metro can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=27137
The latest build of LinqConect for Metro can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=27137