Details:
System.InvalidOperationException
HResult=0x80131509
Message=BeginExecuteNonQuery requires an open and available Connection. The connection's current state is closed.
Source=System.Data.SqlClient
StackTrace:
at System.Data.SqlClient.SqlCommand.ValidateCommand(Boolean async, String method)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName) at System.Data.SqlClient.SqlCommand.BeginExecuteNonQuery(AsyncCallback callback, Object stateObject) at System.Threading.Tasks.TaskFactory1.FromAsyncImpl(Func3 beginMethod, Func2 endFunction, Action1 endAction, Object state, TaskCreationOptions creationOptions) at System.Threading.Tasks.TaskFactory1.FromAsync(Func3 beginMethod, Func2 endMethod, Object state)
at System.Data.SqlClient.SqlCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Praktika.Form1.<button2_Click>d__9.MoveNext() in D:\Programminng\практика\Praktika\Praktika\Form1.cs:line 149
This exception was originally thrown at this call stack:
[External Code]
Praktika.Form1.button2_Click(object, System.EventArgs) in Form1.cs
private async void button2_Click(object sender, EventArgs e)
{
if (label8.Visible)
label8.Visible = false;
if (!string.IsNullOrEmpty(textBox11.Text) && !string.IsNullOrWhiteSpace(textBox11.Text) &&
!string.IsNullOrEmpty(textBox6.Text) && !string.IsNullOrWhiteSpace(textBox6.Text) &&
!string.IsNullOrEmpty(textBox5.Text) && !string.IsNullOrWhiteSpace(textBox5.Text) &&
!string.IsNullOrEmpty(textBox4.Text) && !string.IsNullOrWhiteSpace(textBox4.Text))
{
SqlCommand command = new SqlCommand("UPDATE [Praktika] SET [LastNAme]=#LastNAme,[Passport]=#Passport,[Cod]=#Cod WHERE [Id]=#Id", sqlConnection);
command.Parameters.AddWithValue("Id", textBox11);
command.Parameters.AddWithValue("LastName", textBox6);
command.Parameters.AddWithValue("Passport", textBox5);
command.Parameters.AddWithValue("Cod", textBox4);
await command.ExecuteNonQueryAsync();
}
else if(!string.IsNullOrEmpty(textBox11.Text) && !string.IsNullOrWhiteSpace(textBox11.Text))
{
label8.Visible = true;
label8.Text = "Id должен быть заполнен!";
}
else
{
label8.Visible = true;
label8.Text = "Поля 'Фамилия','Пасспорт и 'Код' должны быть заполнены";
}
}
[enter image description here][1]
[1]: https://i.stack.imgur.com/F9oyl.png
BeginExecuteNonQuery requires an open and available Connection. The connection's current state is closed
You need to call sqlConnection.Open() before you await command.ExecuteNonQueryAsync();
I don't recommend holding onto a connection at class level; hold a connection string instead and make a new connection:
using var conn = new SqlConnection(classLevelConnStr);
using var command = new SqlCommand(sql, conn);
//parameters etc here
conn.Open();
command.Execute...
conn.Close(); //if you're going to do more work before you return, close after you execute
If you aren't going to do more work after you execute, you can leave the exiting of the using scope to dispose/close the connection. Opening/closing doesn't actually forge a TCP connection to the server, it simply leases and returns a connection from a pool of kept-open TCP connections, for best performance, unless you've turned off pooling (don't).
By holding onto a connection for a long time you can accidentally leave it open (leased), which prevents its re-use, and you can also increase the risk of running into "the connection already has an open reader" type issues if you do something like looping a reader and firing off update queries while you loop; make a new connection every time you want one - it's not a slow thing to create
--
Separately to this:
Please rename your controls after you drop them on a form. It takes seconds to do and prevents your code filling up with meaningless variable names. The process of filling code with junk variable names is called obfuscation, a technique designed to make code hard to read and understand. At some point someone else will have to read your code (us, your coworker or replacement, even you in 6 months time..) and they would rather read firstNameTextBox, ageNumericUpDown than textBox57, numericUpDown13. To understand why it's important, just imagine how confusing C# would be if instead of names like string.Length, string.Substring(int start, int length) Microsoft had called them things like Type1.Integer1, Type1.Method1(Type2 parameter1, Type2 parameter2) to chop up a string you'd be writing code like Type1 s = "Hello"; s = s.Method1(0, s.Integer1 - 3); - it's gobbledegook
To rename a control, you right click on it, choose Properties, and then type a new name in the (Name) line of the property grid - it's at the top. You don't even have to right click if the properties grid is already open, just left click the control
Avoid using AddWithValue on SQLServer. Some databases don't care, but SQLS does: https://www.dbdelta.com/addwithvalue-is-evil/
This code is wonky:
command.Parameters.AddWithValue("LastName", textBox6);
It should look something like:
command.Parameters.Add("#LastName", SqlDbType.VarChar, 30).Value = lastNameTextBox.Text);
Replace 30 with the size of the db column and if your column is an NVarChar change the SqlDbType.VarChar to SqlDbType.NVarChar too
This latter form implements the "rename your controls", it adds a parameter using the exact type on the DB side, and it sets the value to the Text of the textbox.. This latter point is important; the text the user typed is in the .Text property. If you just add a textbox object itself you'll probably end up filling your db up with [System.Windows.Forms.TextBox] in every cell of every row
Related
I have some code that periodically runs a query against a SQL Server database and stores the rows in a dictionary. This code has been running fine in our production environment for about 3 years. Just recently, it has been crashing with an unhandled exception. For troubleshooting purposes, I've removed everything but the column reads, and wrapped everything in a try-catch. Here is the exception:
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadByteArray(Byte[] buff, Int32 offset, Int32 len)
at System.Data.SqlClient.TdsParser.SkipValue(SqlMetaDataPriv md, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.SkipRow(_SqlMetaDataSet columns, Int32 startCol, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.CleanPartialRead()
at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)
I'm using something very similar to:
// query is a simple select from 1 table, not long running by any means
string query = "SELECT col1, col2, col3, col4 FROM db.dbo.tbl_name WITH (nolock)"; //connection timeout
string query = "SELECT col1, col2, col3, col4 FROM db.dbo.tbl_name WITH (nolock) order by col1, col2"; //connection does not time out
SqlCommand command = new SqlCommand(query,connection)
SqlDataReader reader = command.ExecuteReader();
while (!reader.IsClosed && reader.Read()) {
try {
string test0 = reader[0].ToString();
string test1 = reader[1].ToString();
string test2 = reader[2].ToString();
string test3 = reader[3].ToString();
// here is where I would normally processes and store into dictionary
}
catch (Exception e){
//make some noises
}
}
When I run the query with other methods, It returns almost instantly (well under a second), but just to see what would happen, I increased the CommandTimeout to 60 seconds (from the default 30), which just increased the amount of time my program would hang before throwing an exception.
At #frisbee's suggestion I added an order by clause to the query, which stops the connection from timing out.
What I think is happening is that one of the Read() operations is not returning, and then causing the connection to timeout, but I have no idea what would cause this. This usually happens on a certain row when reading column 3, but not always. The query returns just under 50k rows, and sometimes it will make it through all, and sometimes only through 15k
Why don't you go ahead and set the CommandTimeout property of your SqlCommand instance to a high number? This will get your code working.
On the other end, you'll need to debug whatever's taking the server so long to finish its work. You can't do anything about that from the .NET side. You'll have to step through the underlying code that is executed on the SQL Server.
Why is it you are checking if the reader is closed on your while loop?
Try using using to ensure things are getting handled correctly. The following should make everything flow smoothly for you.
using (SqlConnection connection = MyDBConnection)
{
connection.Open();
SqlCommand command = new SqlCommand("SQL Query Here", connection) { CommandTimeout = 0 };
using (var reader = command.ExecuteReader())
{
try
{
while (reader.Read())
{
string test0 = reader[0].ToString();
string test1 = reader[1].ToString();
string test2 = reader[2].ToString();
string test3 = reader[3].ToString();
}
}
catch (Exception e)
{
//Make some Noise
}
}
}
Every other run? Are you possibly sharing a command?
If you are using MARS and sharing a connection - don't
using (SqlCommand cmd = con.CreateCommand)
{
using (SqlDataReader rdr = cmd.ExecuteReader())
{
}
}
So I'm trying to use a MySqlDataReader to acquire data from my database. I know that the database does in fact respond (insert, delete, and update all work fine from my program).
using (MySqlConnection conn = new MySqlConnection(connectionString))
{
// Open a connection
conn.Open();
MySqlCommand command = conn.CreateCommand();
command.CommandText = "select * from cs3500_u0848199.PairedGames";
// Execute the command and cycle through the DataReader object
using (MySqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{ /*do something here*/}
}
}
The problem does not appear to be with the command itself, as the command works in the MySQL workbench. Anyways, upon executing this line of code
using (MySqlConnection conn = new MySqlConnection(connectionString))
the VS debugger notes that the following exception was thrown
System.FormatException was unhandled by user code
HResult=-2146233033 Message=Guid should contain 32 digits with 4
dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). Source=mscorlib
StackTrace:
at System.Guid.TryParseGuidWithNoStyle(String guidString, GuidResult& result)
at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
at System.Guid..ctor(String g)
at MySql.Data.Types.MySqlGuid.MySql.Data.Types.IMySqlValue.ReadValue(MySqlPacket
packet, Int64 length, Boolean nullVal)
at MySql.Data.MySqlClient.NativeDriver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue valObject)
at MySql.Data.MySqlClient.Driver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue value)
at MySql.Data.MySqlClient.ResultSet.ReadColumnData(Boolean outputParms)
at MySql.Data.MySqlClient.ResultSet.NextRow(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlDataReader.Read()
at ToDoList.BoggleService.GetBriefStatus(String gameToken) in d:\repositories\x0848199\PS11\ToDoService\BoggleService.svc.cs:line
443
at SyncInvokeGetBriefStatus(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc) InnerException:
Really unsure as to why it's telling me about the guid format since i'm not using Guids in this code.
Any help will be greatly appreciated.
it appears that appending ;old guids=true; to the connection string resolved the issue.
An Oracle Stored Procedure runs in the database and returns some rows of data, taking 30 sec.
Now, calling this procedure and filling the DataAdapter to then populate the DataSet takes 1m40s in a C# .NET application.
Testing, noticed that using a DataReader and reading secuentially with the Read() function after calling the stored procedure, takes again a total time of 1m40s aprox.
Any idea what could be causing these bottlenecks and how to get rid of them?
Thanks in advance!
Edit: Added the code
OracleConnection oracleConnection = Connect();
OracleCommand oracleCommand = CreateCommand(2);
OracleDataReader oracleDataReader = null;
if (oracleConnection != null)
{
try
{
if (oracleConnection.State == ConnectionState.Open)
{
oracleCommand.Connection = oracleConnection;
oracleDataReader = oracleCommand.ExecuteReader();
DateTime dtstart = DateTime.Now;
if (oracleDataReader.HasRows)
{
while (oracleDataReader.Read())
{
/* big Bottleneck here ... */
// Parse the fields
}
}
DateTime dtEnd = DateTime.Now;
TimeSpan ts = new TimeSpan(dtEnd.Ticks - dtstart.Ticks);
lblDuration2.Text = "Duration: " + ts.ToString();
Disconnect(oracleConnection);
}
This might help, though the lack of information on how you're actually using the reader.
using (var cnx = Connect())
using (var cmd = CreateCommand(2)) {
try {
if (cnx.State == ConnectionState.Close) cnx.Open()
// The following line allows for more time to be allowed to
// the command execution. The smaller the amount, the sooner the
// command times out. So be sure to let enough room for the
// command to execute successfuly
cmd.CommandTimeout = 600;
// The below-specified CommandBehavior allows for a sequential
// access against the underlying database. This means rows are
// streamed through your reader instance and meanwhile the
// program reads from the reader, the reader continues to read
// from the database instead of waiting until the full result
// set is returned by the database to continue working on the
// information data.
using (var reader = cmd.ExecuteReader(
CommandBehavior.SequentialAccess)) {
if (reader.HasRows)
while (reader.Read()) {
// Perhaps bottleneck will disappear here...
// Without proper code usage of your reader
// no one can help.
}
}
} catch(OracleException ex) {
// Log exception or whatever,
// otherwise might be best to let go and rethrow
} finally {
if (cnx.State == ConnectionState.Open) cnx.Close();
}
}
For more detailed information on command behaviours: Command Behavior Enumeration.
Directly from MSDN:
Sequential Access
Provides a way for the DataReader to handle rows that contain columns with large binary values. Rather than loading the entire row, SequentialAccess enables the DataReader to load data as a stream. You can then use the GetBytes or GetChars method to specify a byte location to start the read operation, and a limited buffer size for the data being returned.
When you specify SequentialAccess, you are required to read from the columns in the order they are returned, although you are not required to read each column. Once you have read past a location in the returned stream of data, data at or before that location can no longer be read from the DataReader. When using the OleDbDataReader, you can reread the current column value until reading past it. When using the SqlDataReader, you can read a column value only once.
As for increasing the CommandTimeout property, have a look at this post:
Increasing the Command Timeout for SQL command
When you expect the command to take a certain amount of time, one shall require a longer timeout and allow for the command to return before it times out. When a timeout occurs, it takes a few seconds to be resume from it. All this may be avoided. You might want to measure the time required for the timeout and specify it as close as possible to the real command timeout requirement, as a longer timeout might incur some other underlying problems which won't be detected with a too long timeout. When a command timeout occurs, ask yourself how you could deal with a smaller result set, or how you could improve your query to run faster.
The following line of code sometimes results in "Specified cast is not valid" exception:
public static object Select(string sql, OleDbTransaction dbt)
{
try
{
OleDbCommand cmd = new OleDbCommand(sql, lib.dbc, dbt);
object obj = cmd.ExecuteScalar(); /* <- this is what fails */
return obj;
}
catch (Exception ex)
{
/* deleted code - error message to the user */
return null;
}
}
This function is executed several times in the program before it fails. If fails olny when it's executed in a new execution thread, and then only sometimes. When I call the part of the program which performs processing in a thread, and it calls this function, either it works all the time (=> I click the button, it executes, no error, I click and execute again and again...), or it never works (=> I click the button and execute, exception, I click and execute again, exception again...).
lib.dbc -> static variable of type OleDbConnection initialized only at program startup and used very often throughout the code, valid
I have no idea how to debug it any further, and above all, what assignment to a variable of type object can fail? ExecuteScalar should return object or null. Database I'm using is Jet (MS Access).
In the exception I find this stack trace, maybe it can help:
at System.Data.OleDb.OleDbConnection.IOpenRowset()
at System.Data.OleDb.OleDbCommand.ExecuteTableDirect(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteScalar()
at FK.sql.Select(String sql, OleDbTransaction dbt)
If fails olny when it's executed in a new execution thread, and then only sometimes.
This statement, combined with the fact you're passing in the connection as a parameter, suggests you may be trying to use the same database connection, and maybe transaction, on multiple threads.
Don't: instead create a new connection each time you want to access the database: connection pooling means that this will be efficient.
Try this, just as a diagnostic tool:
public static object Select(string sql, OleDbTransaction dbt)
{
try
{
using (OleDbConnection con = new OleDbConnection(lib.dbc.ConnectionString))
using (OleDbCommand cmd = new OleDbCommand(sql, con, dbt))
{
object obj = cmd.ExecuteScalar();
return obj;
}
}
catch (Exception ex)
{
/* deleted code - error message to the user */
return null;
}
}
This may help determine whether you have a threading problem.
When adding or removing a job to/from the scheduler, Quartz sporadically throws a JobPersistenceException (following a preceding SQLiteException).
Things that seem noteworthy:
Quartz.NET 2.01 + System.Data.SQLite 1.0.66 (both latest version at time of writing just noticed that there is a binary package for SQLite 1.0.82 available)
the exception is also thrown if there is currently no job/trigger beeing executed (i am monitoring the Quartz listeners)
the Jobs are manually added from UI context (i require about 10-20 repetitions to cause the error but it seems totally random)
Everything seems to be running fine (multiple jobs, parallel execution, persistance after application restart) as long as i don't touch AddJob()/DeleteJob() After extended testing i am sure its not related to adding/removing jobs. The db locking/access problems are a general problem.
Is there any recommended procedure i am not aware that must be followed when adding/deleting jobs?
Is there anything wrong with my ISchedulerFactory configuration? (see below)
Supplemental
I tried using System.Data.SQLite 1.0.82 which made things worse. I get "SQLite error (5): database is locked" almost constantly as soon as Quartz is executing a Job.
Quartz.NET list System.Data.SQLite 1.0.56 as supported db provider so one might expect problems using a newer version. However, i don't consider going back from 1.0.66 as an option since there were lots of improvements/fixes IIRC.
I took a look at the development trunk of Quartz.NET between the 2.0.1 release revision (624) and current head revision (669). There seem to be no related fixes.
I suspect that its a System.Data.SQLite issue. I stumbled over several posts (concerning different SQLite versions) mentioning that there might be some issues with internal disposing of resources, keeping the DB file locked.
Supplemental 2
For now, I gave up on this. I tried a lot of things, but development has to go on. I switched to another database type (Firebird) which so far seems to work fine with Quartz.
If somebody gets this working i would love to hear about it anyway.
-
Exception details:
Quartz.JobPersistenceException: "Couldn't commit ADO.NET transaction. The database file is locked\r\ndatabase is locked"
Stack
bei Quartz.Impl.AdoJobStore.JobStoreSupport.CommitConnection(ConnectionAndTransactionHolder cth, Boolean openNewTransaction)
bei Quartz.Impl.AdoJobStore.JobStoreSupport.ExecuteInNonManagedTXLock(String lockName, Func`2 txCallback)
bei Quartz.Impl.AdoJobStore.JobStoreTX.ExecuteInLock(String lockName, Func`2 txCallback)
bei Quartz.Impl.AdoJobStore.JobStoreSupport.RemoveJob(JobKey jobKey)
bei Quartz.Core.QuartzScheduler.DeleteJob(JobKey jobKey)
bei Quartz.Impl.StdScheduler.DeleteJob(JobKey jobKey)
InnerException SQLiteException: "The database file is locked\r\ndatabase is locked"
Stack
bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
bei System.Data.SQLite.SQLiteDataReader.NextResult()
bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
bei System.Data.SQLite.SQLiteTransaction.Commit()
bei Quartz.Impl.AdoJobStore.JobStoreSupport.CommitConnection(ConnectionAndTransactionHolder cth, Boolean openNewTransaction)
The source of the exception is "cth.Transaction.Commit();" in this Quartz.NET method.
/// <summary>
/// Commit the supplied connection.
/// </summary>
/// <param name="cth">The CTH.</param>
/// <param name="openNewTransaction">if set to <c>true</c> opens a new transaction.</param>
/// <throws>JobPersistenceException thrown if a SQLException occurs when the </throws>
protected virtual void CommitConnection(ConnectionAndTransactionHolder cth, bool openNewTransaction)
{
CheckNotZombied(cth);
if (cth.Transaction != null)
{
try
{
IsolationLevel il = cth.Transaction.IsolationLevel;
cth.Transaction.Commit();
if (openNewTransaction)
{
// open new transaction to go with
cth.Transaction = cth.Connection.BeginTransaction(il);
}
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't commit ADO.NET transaction. " + e.Message, e);
}
}
}
This is how i create the ISchedulerFactory:
public static ISchedulerFactory CreateSQLiteSchedFactory(SQLiteConnection sqlConn, string tablePrefix) {
// db provider hinzufügen
var metaData = new DbMetadata();
metaData.AssemblyName = "System.Data.SQLite,Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139";
metaData.BindByName = true;
metaData.CommandBuilderType = typeof(SQLiteCommandBuilder);
metaData.CommandType = typeof(SQLiteCommand);
metaData.ConnectionType = typeof(SQLiteConnection);
metaData.ExceptionType = typeof(SQLiteException);
metaData.ParameterDbType = typeof(TypeAffinity);
metaData.ParameterDbTypePropertyName = "DbType";
metaData.ParameterNamePrefix = "#";
metaData.ParameterType = typeof(SQLiteParameter);
metaData.UseParameterNamePrefixInParameterCollection = true;
DbProvider.RegisterDbMetadata("SQLite-1066", metaData);
// konfiguration für factory erstellen
NameValueCollection properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "TestScheduler";
properties["quartz.scheduler.instanceId"] = "instance_one";
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
properties["quartz.jobStore.misfireThreshold"] = "60000";
properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
properties["quartz.jobStore.useProperties"] = "false";
properties["quartz.jobStore.dataSource"] = "default";
properties["quartz.jobStore.tablePrefix"] = tablePrefix;
properties["quartz.jobStore.clustered"] = "true";
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
properties["quartz.dataSource.default.connectionString"] = sqlConn.ConnectionString;
properties["quartz.dataSource.default.provider"] = "SQLite-1066";
// factory erzeugen
return new StdSchedulerFactory(properties);
}
The SQLiteConnection is created with connectionstring similar to "Data Source=c:\mydb.db;Version=3;" and all the quartz tables are initialized using the supplied SQL script
You have to set this one to true in the properties:
properties["quartz.jobStore.txIsolationLevelSerializable"] = "true";
The cause of this error is most likely to be because of multiple concurrent writes on the SQLite db, sqlite can accept multiple read-only connections only, but the can't accept simultaneous writes!
http://www.sqlite.org/faq.html#q5