英文:
How to install HDBODBC Drivers in a Linux Dockerfile?
问题
我正在尝试从 Linux Dockerfile 连接到 SAP HANA 数据库。目前在 Dockerfile 中安装 HDBODBC 驱动程序或找到相关资源方面遇到了困难。
- 我该如何在 Dockerfile 中安装 HDBODBC 驱动程序?
- 我是否需要一个 odbc.ini 文件,或者仅使用连接字符串就足够了?
注意:我熟悉在没有 Docker 的情况下以及在 Windows 上使用连接字符串连接到 SAP HANA。
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] 连接到数据库时出错] {
odbcErrors: [
{
state: '01000',
code: 0,
message: "[unixODBC][驱动程序管理器]无法打开库 'HDBODBC':文件未找到"
}
]
}
这让我认为我没有安装驱动程序。
英文:
I am trying to connect to a SAP HANA database from a Linux Dockerfile. Currently having trouble with installing the HDBODBC Driver in the Dockerfile or finding resources for it.
- How can I install HDBODBC Driver in a Dockerfile?
- Do I need an odbc.ini file or is using a connection string sufficient?
Note: I am familiar with connecting to SAP HANA without docker and on Windows using a connection string
Dockerfile currently:
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"]
When I run my code with just the connection string I am seeing:
[Error: [odbc] Error connecting to the database] {
odbcErrors: [
{
state: '01000',
code: 0,
message: "[unixODBC][Driver Manager]Can't open lib 'HDBODBC' : file not found"
}
]
}
Which makes me think I don't have the driver installed
答案1
得分: 1
你需要 HANA 客户端。请前往:https://tools.hana.ondemand.com/#hanatools
英文:
You need the HANA Client. Try here: https://tools.hana.ondemand.com/#hanatools
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论