I am trying to connect to Vertica DB from my Serverless ASP.NET Core API (with Amazon Lambda). To do this, I build a docker container to install the ODBC driver along with creating my lambda function. The docker image successfully is built and created, but fails with below exception when a connection is attempted via ODBC:
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. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibodbc.so.2: cannot open shared object file: No such file or directory
Here are the docker files I have tried so far:
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y curl
#downloading the relevant linux driver for this docker environment
RUN curl -O https://www.vertica.com/client_drivers/12.0.x/12.0.1-0/vertica-client-12.0.1-0.x86_64.tar.gz
RUN ls -la
RUN tar vzxf vertica-client-12.0.1-0.x86_64.tar.gz && rm vertica-client-12.0.1-0.x86_64.tar.gz
RUN apt-get install -y unixodbc-dev
ENV ODBCINI=/etc/.odbc.ini
ENV VERTICAINI=/etc/vertica.ini
And,
FROM mcr.microsoft.com/dotnet/aspnet:6.0
RUN apt-get update
RUN apt-get -y install curl g++ make bzip2
RUN curl http://www.unixodbc.org/unixODBC-2.3.7.tar.gz | tar xz
WORKDIR unixODBC-2.3.7
RUN ./configure && make && make install
RUN ldconfig
WORKDIR /usr/local/lib
RUN ls
RUN mkdir -p /var/log/unixodbc
RUN mkdir -p /opt/vertica-odbc-driver
RUN cd /opt/vertica-odbc-driver && curl https://www.vertica.com/client_drivers/9.2.x/9.2.0-0/vertica-client-9.2.0-0.x86_64.tar.gz | tar xz
RUN cp /opt/vertica-odbc-driver/opt/vertica/include/* /usr/include
ENV ODBCINI=/usr/local/etc/odbc.ini
ENV VERTICAINI=/etc/vertica.ini
I created the docker files using this tutorial and this question.