如何在 Linux Dockerfile 中安装 HDBODBC 驱动程序?

问题描述 投票:0回答:1

我正在尝试从 Linux Dockerfile 连接到 SAP HANA 数据库。当前在 Dockerfile 中安装 HDBODBC 驱动程序或为其查找资源时遇到问题。

  1. 如何在 Dockerfile 中安装 HDBODBC 驱动程序?
  2. 我需要 odbc.ini 文件还是使用连接字符串就足够了?

注意:我熟悉如何在没有 Docker 的情况下连接到 SAP HANA,以及在 Windows 上使用连接字符串

当前 Dockerfile:

FROM --platform=linux/amd64 node:16.13.0

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm install

RUN apt-get update && apt-get install -y unixodbc unixodbc-dev
RUN apt-get install odbcinst

COPY . .
EXPOSE 8080
CMD ["node", "src/index.js"]

当我仅使用连接字符串运行代码时,我看到:

[Error: [odbc] Error connecting to the database] {
   odbcErrors: [
     {
       state: '01000',
       code: 0,
       message: "[unixODBC][Driver Manager]Can't open lib 'HDBODBC' : file not found"
     }
   ]
 }

这让我以为我没有安装驱动程序

docker odbc hana unixodbc
1个回答
0
投票

您需要 HANA 客户端。在这里尝试:https://tools.hana.ondemand.com/#hanatools

© www.soinside.com 2019 - 2024. All rights reserved.