基于Amazon Lambda的Serverless ASP.NET Core API连接Vertica DB遇ODBC依赖问题
问题:基于Amazon Lambda的无服务器ASP.NET Core API连接Vertica数据库失败
我正尝试通过基于Amazon Lambda的无服务器ASP.NET Core API连接Vertica数据库,为此构建了Docker容器以安装ODBC驱动并创建Lambda函数。镜像构建成功,但尝试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
以下是我尝试过的两个Dockerfile:
第一个Dockerfile
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
第二个Dockerfile
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
我参考了相关技术教程和Stack Overflow问题编写上述Dockerfile。
内容的提问来源于stack exchange,提问作者user2266688
相关产品推荐
相关产品推荐

