.NET Core System.Exception: Unknown database type specified at DataTables.Database.Adapter()

.NET Core System.Exception: Unknown database type specified at DataTables.Database.Adapter()

JormJorm Posts: 16Questions: 4Answers: 0

Hello,

I'm trying out .NET Core with DataTables Editor and am having an issue connecting to the database. Indications are there's an issue at DataTables.Database.Adapter() in /home/vagrant/DataTablesSrc/extensions/Editor-NET/DataTables-Editor-Server/Database.cs:line 170.

I don't know how to actually get to that file to see what it says.

I downloaded the demo and that works fine: this error is generating for a project where the .NET Core Editor stuff was acquired into the project via NuGet (Version 1.8.1).

I've modified the launchSetttings.json, program.cs files as per installation instructions at editor.datatables.net/manual/net/core. Again, I have the editor .NET Core demo running fine.

I'm not sure what other information to provide at this point.

Thanks in advance for any insight,
-j

Replies

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin

    Its here.

    Can you show me how you have configured the database? In .NET Core you need to include the database driver class and then register it in your program.cs file - see the "NuGet -> Database connection" part of the documentation here.

    Allan

  • JormJorm Posts: 16Questions: 4Answers: 0

    Hi Allan,

    What I should have mentioned (didn't know enough to know), is that I'm trying to wrap this .NET core app in Electron, because of the benefits offered by a desktop application in my particular environment. I know now that it's that part that's making something not work.

    I can run the app in a browser and it works, gets data from the database, but when I run the exact same app through Electron, I get the datatables.net/tn/7 error, or more specifically this "Uknown database type specified" (per the readout in Package Manager Console of Visual Studio). The view page with all it's css and html loads, the data in the table does not.

    It seems like things aren't getting called right, or in the right sequence. I've already had to reposition scripts because of issues with the _layout page not flowing through to other views like it should (and the jQuery-3.3.1 one had to be at the *absolute* top of everything, where this isn't the case otherwise). I've mucked around with ports too, because, well, I don't know.

    Electron uses Node.js, so I have wondered if perhaps I need to do something with that to make DataTables work, maybe?

    I realize that this likely has very little to do with DataTables - just wanted to elaborate on what I've determined. If you happen to know off the top of your head what might be the issue, much appreciated, but I get that this is my Electron problem, not yours <smile>!

    Because you asked, I've got launchSettings as:

     "DBTYPE": "sqlserver",
     "DBCONNECTION": "data source=<server>;Initial catalog=<database>;Integrated Security=True"
    

    ... and have tried the variant:

    "DBCONNECTION": "server=<server>;database=<database>;Integrated Security=True"
    

    and in Programs.cs I'm registering with:

     DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
    

    Cheers,
    -Jorm

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin

    Hi Jorm,

    Interesting! So when you run it as an Electron app, is it making Ajax calls to a backend process somewhere, and it is that backend process that is throwing the errors about the database? And am I right in say that it is the same backend process for both the Electron app and the browser based UI's (i.e. not just the same code, but actually the same server instance)?

    Allan

This discussion has been closed.