question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Microsoft.Data.Sqlite provider on .NET Core

See original GitHub issue

Using Version: 3.0.0-alpha3

Trying to use Sqlite with Quartz scheduler with System.Data.Sqlite.Core (1.0.105.2) with the following configuration:

NameValueCollection props = new NameValueCollection { //{ “quartz.serializer.type”, “binary” }, { “quartz.threadPool.type”, “Quartz.Simpl.SimpleThreadPool, Quartz” }, { “quartz.threadPool.threadCount”, “10” }, { “quartz.jobStore.type”, “Quartz.Impl.AdoJobStore.JobStoreTX, Quartz” }, { “quartz.jobStore.misfireThreshold”, “60000” }, { “quartz.jobStore.lockHandler.type”, “Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz” }, { “quartz.jobStore.useProperties”, “true” }, { “quartz.jobStore.dataSource”, “default” }, { “quartz.jobStore.tablePrefix”, “QRTZ_” }, { “quartz.jobStore.driverDelegateType”, “Quartz.Impl.AdoJobStore.SQLiteDelegate, Quartz” }, { “quartz.dataSource.default.provider”, “SQLite-10” }, { “quartz.dataSource.default.connectionString”, “Data Source=quartznet.db;Version=3;” }

            };

Actual behavior

Quartz.SchedulerException: Could not Initialize DataSource: SqliteDS —> System.ArgumentOutOfRangeException: There is no metadata information for provider ‘SQLite-10’ Parameter name: providerName at Quartz.Impl.AdoJobStore.Common.DbProvider.GetDbMetadata(String providerName) in C:\projects\quartznet-6fcn8\src\Quartz\Impl\AdoJobStore\Common\DbProvider.cs:line 118 at Quartz.Impl.AdoJobStore.Common.DbProvider…ctor(String dbProviderName, String connectionString) in C:\projects\quartznet-6fcn8\src\Quartz\Impl\AdoJobStore\Common\DbProvider.cs:line 74 at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__65.MoveNext() in C:\projects\quartznet-6fcn8\src\Quartz\Impl\StdSchedulerFactory.cs:line 614 — End of inner exception stack trace — at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__65.MoveNext() in C:\projects\quartznet-6fcn8\src\Quartz\Impl\StdSchedulerFactory.cs:line 623 — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Quartz.Impl.StdSchedulerFactory.<GetScheduler>d__69.MoveNext() in C:\projects\quartznet-6fcn8\src\Quartz\Impl\StdSchedulerFactory.cs:line 1118 — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at BackgroundProcessingWithQuartz.Program.<RunProgram>d__1.MoveNext() in /Users/Projects/BackgroundProcessingWithQuartz/BackgroundProcessingWithQuartz/BackgroundProcessingWithQuartz/Program.cs:line 44 [See nested exception: System.ArgumentOutOfRangeException: There is no metadata information for provider ‘SQLite-10’ Parameter name: providerName at Quartz.Impl.AdoJobStore.Common.DbProvider.GetDbMetadata(String providerName) in C:\projects\quartznet-6fcn8\src\Quartz\Impl\AdoJobStore\Common\DbProvider.cs:line 118 at Quartz.Impl.AdoJobStore.Common.DbProvider…ctor(String dbProviderName, String connectionString) in C:\projects\quartznet-6fcn8\src\Quartz\Impl\AdoJobStore\Common\DbProvider.cs:line 74 at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__65.MoveNext() in C:\projects\quartznet-6fcn8\src\Quartz\Impl\StdSchedulerFactory.cs:line 614

Steps to reproduce

What I am missing? Everything is installed through NuGet on my Visual Studio for Mac. Plus why are there are references to the C Drive when the dll is actually running on a Mac. Please help.

// scheduler and job configuration, SystemTime prefereably set to fixed point

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lahmacommented, Sep 6, 2017

Sorry for the delay, here’s an example I quickly put together, your mileage might vary. NET Core 2.0 console app referencing required libs

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Data.Sqlite" Version="2.0.0" />
    <PackageReference Include="Quartz" Version="3.0.0-alpha3" />
  </ItemGroup>
</Project>

using System;
using System.Collections.Specialized;
using System.Data;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.Sqlite;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.AdoJobStore.Common;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            Run().GetAwaiter().GetResult();
        }

        private static async Task Run()
        {
            DbProvider.RegisterDbMetadata("sqlite-custom", new DbMetadata()
            {
                AssemblyName = typeof(SqliteConnection).Assembly.GetName().Name,
                ConnectionType = typeof(SqliteConnection),
                CommandType = typeof(SqliteCommand),
                ParameterType = typeof(SqliteParameter),
                ParameterDbType = typeof(DbType),
                ParameterDbTypePropertyName = "DbType",
                ParameterNamePrefix = "@",
                ExceptionType = typeof(SqliteException),
                BindByName = true
            });


            var properties = new NameValueCollection
            {
                ["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz",
                ["quartz.jobStore.useProperties"] = "true",
                ["quartz.jobStore.dataSource"] = "default",
                ["quartz.jobStore.tablePrefix"] = "QRTZ_",
                ["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SQLiteDelegate, Quartz",
                ["quartz.dataSource.default.provider"] = "sqlite-custom",
                ["quartz.dataSource.default.connectionString"] = "Data Source=test.db",
                ["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz",
                ["quartz.serializer.type"] = "binary"
            };


            ISchedulerFactory sf = new StdSchedulerFactory(properties);
            IScheduler sched = await sf.GetScheduler();

            await sched.Start();

            Thread.Sleep(TimeSpan.FromMinutes(10));
        }
    }
}
0reactions
raffaelercommented, Oct 2, 2017

Got it, thanks. As I am not familiar with this project, I had no idea of the scripts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft.Data.Sqlite overview
Microsoft.Data.Sqlite is a lightweight ADO.NET provider for SQLite. The Entity Framework Core provider for SQLite is built on top of this ...
Read more >
.NET Core: Introduction To Microsoft.Data.Sqlite
“SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the ...
Read more >
Microsoft.Data.Sqlite.Core 7.0.10
Version Downloads Last updated 8.0.0‑preview.7.23375.4 1,313 5 days ago 8.0.0‑preview.6.23329.4 9,217 a month ago 8.0.0‑preview.5.23280.1 11,033 2 months ago
Read more >
Connect to SQLite Database with Entity Framework Core
This post shows goes through the steps to connect a .NET 6 API to SQLite using Entity Framework Core, and automatically create/update the ......
Read more >
Connecting to a Sqlite Database using .Net Core
Since the purpose of this post is just to illustrate a basic connection to Sqlite, we will be using a simple console application....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found