4

I want to connect to Vertica DB from .Net Core app but the Vertica.Data package is not compatible with .Net Core. Have been searching for another package which works for .Net core but did not find anything. Is there any other workaround to query Vertica from .Net core app?

nimisha shrivastava
  • 2,357
  • 2
  • 16
  • 31

2 Answers2

5

There are no .NET Core-compatible Vertica ADO.NET connector yet (that targets netstandard); you may contact Vertica support and ask them if they have any plans on this.

Vertica has ODBC drivers for both Windows and Linux, but unfortunately .NET Core 1.1 (netstandard 1.6) has no ODBC connector yet. According to https://github.com/dotnet/corefx/pull/15646 it is scheduled for nestandard2.0 (preview version is expected in Q2 2017) and already merged into development branch.

--- update ---

System.Data.Odbc has stable release and it works fine on both Windows and Linux.

Vitaliy Fedorchenko
  • 8,447
  • 3
  • 37
  • 34
  • Thanks for the details. That's what I had also found after a lot of research. – nimisha shrivastava Apr 28 '17 at 21:47
  • System.Data.Odbc I also checked it worked, but did not use in production – codemirror Apr 27 '20 at 11:04
  • 1
    @codemirror I use System.Data.Odbc in production on Linux (Docker) and it works just fine. – Vitaliy Fedorchenko Apr 28 '20 at 07:08
  • When I use System.Data.Odbc on Linux(Docker) it throws the below error: System.DllNotFoundException: Dependency unixODBC with minimum version 2.3.1 is required. Unable to load shared library 'libodbc.so.2' or one of its dependencies – Elias Ghali Feb 24 '21 at 13:55
  • @EliasGhali on Linux .NET ODBC driver requires 'unixODBC'. To include it into the docker image add to the dockerfile: `RUN apt-get update -y && apt-get install -y --no-install-recommends unixodbc && rm -rf /var/cache/apt` – Vitaliy Fedorchenko Feb 24 '21 at 17:05
  • Thank you @VitaliyFedorchenko, after this change I get another error: ` System.PlatformNotSupportedException: System.Data.ODBC is not supported on this platform` I have posted a related question, maybe you can help, https://stackoverflow.com/questions/66354634/dotnet-core-odbc-vertica-with-docker?noredirect=1#comment117309947_66354634 – Elias Ghali Feb 24 '21 at 17:32
  • 1
    @EliasGhali it is definitely possible to use System.Data.Odbc with .NET Core 3.1 on Linux (docker), it works perfectly for me. Please ensure that you use right version of nuget package: `` – Vitaliy Fedorchenko Feb 24 '21 at 20:06
0

You can use Vertica.Data package from Nuget provided by HP Vertica in .net core 2.1+,

while build it shows warning

"Package Vertica.Data was restored using .NETFramework instead of target framework .NETCoreAPP"

but it works fine, I didn't test it in production though.

use it using

using Vertica.Data.VerticaClient;

update

It works when you deploy in Windows environment, but in Linux environment it does not work.

codemirror
  • 3,164
  • 29
  • 42
  • 2
    It works when you deploy in Windows environment, in Linux environment it does not work. – codemirror Nov 13 '19 at 14:24
  • "Vertica.Data" last updated in 2016, it doesn't include netstandard2.0+ build for full compatibility with .NET Core / .NET 5 which often run on Linux as a docker container where "Vertica.Data" doesn't work, so it is strange that answer is accepted. – Vitaliy Fedorchenko Jan 29 '21 at 07:18