Struggling with DA and ElevateDB

I’m struggling to get a custom DA server to use an ElevateDB data provider.

I’ve tried lots of things but keep getting:
Unable to find the requested .Net Framework Data Provider. It may not be installed.

Using Schema Modeler 7 can access the database no problem. Also when creating a new DA project, I do see the database’s tables, etc. in the wizard.

Here is a simplified project that gives me the error. I borrowed the connection string from the Schema Modeler connection window.

using System;
using RemObjects.DataAbstract.Server;

namespace ConsoleApplication1
{
class Program
{
static void Main()
{
Configuration.Load();

		var connection = new BaseConnection("--", @"ElevateDB.NET?ConfigPath=c:\devdata\vs2017\da-test\db;Type=Local;Password=XXXX;Database=mydb;UserID=XXXX;");

		connection.Open();

		connection.Close();

		Console.WriteLine("Done");
	}
}

}

BTW, I’m running the Trial version of DA, if that makes a difference.

Still no progress but I have updated the test code to show that the problem is most likely related to DA (or more likely something I’m doing wrong with DA)

using System;
using RemObjects.DataAbstract.Server;
using Elevate.ElevateDB.Data;

namespace ConsoleApplication1
{
	class Program
	{
		static void Main()
		{
			// direct connection to database
			var directConnection = new EDBConnection(@"Type=Local;ConfigPath=c:\devdata\vs2017\da-test\db;Database=mydb;UID=Administrator;PWD=EDBDefault;");
			directConnection.Open();
			Console.WriteLine("Direct connection opened");
			directConnection.Close();
			Console.WriteLine("Direct connection closed");

			// DA connection to database
			Configuration.Load();
			var daConnection = new BaseConnection("--", @"ElevateDB.NET?Type=Local;ConfigPath=c:\devdata\vs2017\da-test\db;Database=mydb;UID=Administrator;PWD=EDBDefault;");
			daConnection.Open();
			Console.WriteLine("DA connection opended");
			daConnection.Close();
			Console.WriteLine("DA connection closed");
		}
	}
}

This is the output I get:


C:\devdata\vs2017\test\ConsoleApplication1\Bin\Debug>ConsoleApplication1.exe
Direct connection opened
Direct connection closed

Unhandled Exception: System.ArgumentException: Unable to find the requested .Net
 Framework Data Provider.  It may not be installed.
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariant
Name)
   at RemObjects.DataAbstract.Server.DataProviderInfo.GetFactory()
   at RemObjects.DataAbstract.Server.BaseConnection.Open()
   at ConsoleApplication1.Program.Main() in C:\devdata\vs2017\test\ConsoleApplic
ation1\Program.cs:line 20

C:\devdata\vs2017\test\ConsoleApplication1\Bin\Debug>

Thoughts?

Hello

In your second testcase two different approaches are used to load the database driver:

  • direct EDBConnection call relies on the assembly being referenced by the application
  • DataAbstract call uses ADO.NET provider that has be registered in the machine.config. The error you get means that there is no ElevateDB provider registration in the machine.config file for this particular .NET runtime version / bitness.

F.e. by default ElevateDB doesn’t register itself for x64 applications. Most probably this is what caused the issue you describe.

Possible solutions are to either register the DB provider in machine.config or to alter the Data Abstract configuration to directly use the ADO.NET driver assembly.

Latter approach is easier to maintain and it makes it easier to deploy the server application later.

Steps required:

  1. Add reference to the Elevate.ElevateDB.Data assembly. Set reference Copy Local property to true
  2. Add to the server project file C:\Program Files (x86)\RemObjects Software\Data Abstract for .NET\Source\RemObjects.DataAbstract.Server\DataAbstract.daConfig
  3. Set BuildAction of the added file to EmbeddedResource

After this step the server application will use its own copy of the DataAbstract.daConfig file. This file contains descriptions of the database drivers used by Data Abstract.

  1. Open the DataAbstract.daConfig file as XML using Visual Studio or any plain text editor.

  2. Go to line 613, tag ElevateDB.NET. This section contains configuration of the ElevateDB ADO.NET driver

  3. Replace line

     <ProviderName>Elevate.ElevateDB.Data</ProviderName>
    

with

    <AssemblyName Value="Elevate.ElevateDB.Data, Version=2.28.6.0, Culture=neutral, PublicKeyToken=cf9bc1202c75e9e2" />

You may need to adjust the assembly version # here to match the one installed on your workstation.

  1. Save the daConfig file

Now you should be able to access the ElevateDB database w/o issues.

Regards

Thank you very much for the help. There is no way I would have figured out those changes on my own.

However, unfortunately I’m still getting the same error.

I have checked the assembly version for Elevate.ElevateDB.Data on my system, and it matches your example, so that shouldn’t be the problem.

I have zipped up my project and attached it to this post, in case that will help.

I really appreciate the help, but could use a little more. Thanks
ConsoleApplication1.zip (2.0 MB)

Success!!!

Antonk’s instructions were correct.

I had a copy of DataAbstract.daConfig left hanging around in my /bin/Debug/ folder from previous messing around. It appears that it will take preference over the one added to the project as an embedded resource. I removed it an all is well.

Antonk, thanks again for the help.

Glad you have this working now.

Yes, the .daConfig file copies have the following priority:

Local copy of .daConfig -> .daConfig embedded into the application -> Default .daConfig embedded into the RemObjects.DataAbstract.Server assembly

Local copy of the .daConfig file allows to adjust driver settings (f.e. to switch to a newer driver version) without recompiling the application itself.