- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我被告知要单独问这个问题,但它与 this 有关在这里提问。
我在使用官方 Ubuntu (16.04) 创建的 docker 镜像上遇到了确切的问题。它适用于 isql,但不能通过 pyodbc 连接。以下是 odbc 跟踪:
[ODBC][60][1487069096.117665][__handles.c][460]
Exit:[SQL_SUCCESS]
Environment = 0x1458c20
[ODBC][60][1487069096.117687][SQLSetEnvAttr.c][189]
Entry:
Environment = 0x1458c20
Attribute = SQL_ATTR_ODBC_VERSION
Value = 0x3
StrLen = 4
[ODBC][60][1487069096.117695][SQLSetEnvAttr.c][363]
Exit:[SQL_SUCCESS]
[ODBC][60][1487069096.117702][SQLAllocHandle.c][375]
Entry:
Handle Type = 2
Input Handle = 0x1458c20
[ODBC][60][1487069096.117709][SQLAllocHandle.c][493]
Exit:[SQL_SUCCESS]
Output Handle = 0x148ab10
[ODBC][60][1487069096.117719][SQLDriverConnectW.c][290]
Entry:
Connection = 0x148ab10
Window Hdl = (nil)
Str In = [SERVER=server;DATABASE=db;UID=user;PWD=pwd;DRIVER={ODBC Driver 13 for SQL Server};][length = 116]
Str Out = (nil)
Str Out Max = 0
Str Out Ptr = (nil)
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'
[ODBC][60][1487069096.118365][SQLConnect.c][1114]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.1.0' : file not found
[ODBC][60][1487069096.118384][SQLDriverConnect.c][726]
Entry:
Connection = 0x148ab10
Window Hdl = (nil)
Str In = [SERVER=server;DATABASE=database;UID=user;PWD=********;DRIVER={ODBC Driver 13 for SQL Server};][length = 116 (SQL_NTS)]
Str Out = 0x7ffc2880f570
Str Out Max = 2048
Str Out Ptr = (nil)
Completion = 0
UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'
[ODBC][60][1487069096.118786][SQLConnect.c][1114]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.1.0' : file not found
[ODBC][60][1487069096.118802][SQLGetDiagRec.c][680]
Entry:
Connection = 0x148ab10
Rec Number = 1
SQLState = 0x7ffc28810160
Native = 0x7ffc2881014c
Message Text = 0x7ffc28810170
Buffer Length = 1023
Text Len Ptr = 0x7ffc2881014a
[ODBC][60][1487069096.118816][SQLGetDiagRec.c][717]
Exit:[SQL_SUCCESS]
SQLState = 01000
Native = 0x7ffc2881014c -> 0
Message Text = [[unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.1.0' : file not found]
[ODBC][60][1487069096.118832][SQLFreeHandle.c][284]
Entry:
Handle Type = 2
Input Handle = 0x148ab10
[ODBC][60][1487069096.118839][SQLFreeHandle.c][333]
Exit:[SQL_SUCCESS]
这是我的 dockerfile:
FROM ubuntu:latest
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update && \
apt-get clean && \
apt-get -y install curl build-essential \
libssl-dev libldap2-dev libffi-dev libpq-dev apt-transport-https dialog
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && \
ACCEPT_EULA=Y apt-get -y install msodbcsql=13.1.1.0-1 mssql-tools && \
apt-get -y install unixodbc-dev-utf16
CMD ["bin", "bash"]
最佳答案
感谢 Meet 和他在 Microsoft 的伙伴 Luis,我能够在 docker 容器中使用带有 pyodbc 的 conda 分发来连接 SQL Server。下面是他们为我配置的 dockerfile -
# mssql-python-pyodbc
# Python runtime with pyodbc to connect to SQL Server
FROM ubuntu:16.04
# apt-get and system utilities
RUN apt-get update && apt-get install -y \
curl apt-utils apt-transport-https debconf-utils gcc build-essential g++-5\
&& rm -rf /var/lib/apt/lists/*
# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
# install SQL Server drivers
RUN apt-get update && ACCEPT_EULA=Y apt-get -y install msodbcsql
RUN apt-get -y install unixodbc unixodbc-dev
# install SQL Server tools
RUN apt-get update && ACCEPT_EULA=Y apt-get -y install mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN /bin/bash -c "source ~/.bashrc"
# python libraries
RUN apt-get update && apt-get install -y \
python-pip python-dev python-setuptools \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# install necessary locales
RUN apt-get update && apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen
RUN pip install --upgrade pip
# install SQL Server Python SQL Server connector module - pyodbc
RUN pip install pyodbc
RUN curl -LO https://repo.continuum.io/archive/Anaconda2-4.3.0-Linux-x86_64.sh && \
bash Anaconda2-4.3.0-Linux-x86_64.sh -p /Anaconda -b && \
rm Anaconda2-4.3.0-Linux-x86_64.sh && \
rm -rf /var/lib/apt/lists/*
ENV PATH $PATH:/Anaconda/bin
RUN conda update -y conda
# add sample code
RUN mkdir /sample
ADD . /sample
WORKDIR /sample
关于python - 在 ubuntu docker 镜像上连接时,SQL Server 的 ODBC 驱动程序 13 无法在 pyodbc 上打开 lib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42224701/
这个问题已经有答案了: what is the difference between OLE DB and ODBC data sources? (11 个回答) 已关闭10 年前。 OLEDB 和
我正在制作安装脚本并且我正在使用 ODBC,我如何自动将节点添加到 ODBC 数据源。 使用 Visual Studio 安装项目构建安装程序,但我能够为其运行任何脚本。 谢谢。 最佳答案 1) OD
所以我正在将一个旧的 filemaker 数据库传输到 MySQL,一些重复的字段给我带来了一些问题。我读过 ODBC 标准支持这些字段,只有当它们的类型是“文本”并且每个重复都与某个定界符( see
一个月前,我向一个哥们展示了如何使用 .NET 来查询 MySQL。它工作得很好,但他不明白为什么我们需要一个 MySQL 与 ODBC 结合的“驱动程序”。他认为 ODBC 就足够了。 当他问我为什
为什么 ODBC 很慢?底层架构是什么?有人可以对此多加关注> 最佳答案 一般来说(我的意思是 GENERAL)ODBC 驱动程序在混合中添加了另一层。它必须接受您的查询并将其转换为本地查询语言(本地
问题:我正在使用 AsteriskNow,它在 VirtualBox 中运行 asterisk 2.0 服务器。我想使用 ODBC 模块将 Asterisk 与 MySQL 数据库连接起来。但它失败了
我有一个名为“myodbc”的用户定义的 ODBC 连接,其中保存了用户名和密码。这是管理员为我创建的,因此我无法访问凭据。 如何在不传递凭据的情况下与 SAS 建立连接。我认为以下工作会,但我收到无
我最近发现 libname 语句对于访问驻留在 odbc 中的表非常方便。但我不知道如何访问那些具有两级名称的表。下面是一个例子。 我使用的旧代码(此代码有效): proc sql; conn
我们通常使用 MS Visual Foxpro v9.0 SP1、语言、表格和报告。但是,有时我们使用 ODBC 驱动程序连接到表。 ODBC 驱动程序是为 Foxpro v6 编写的,不支持某些嵌套
我第一次尝试在使用 PostgreSQL 9 的 Windows XP Pro 上打开一个程序。我收到一条错误消息: A problem was encountered while trying to
我有一个 spark 集群设置,并在我的数据集上尝试了 native scala 和 spark sql,该设置似乎在大多数情况下都有效。我有以下问题 从 ODBC/外部连接到集群,我应该期待什么?
我正在尝试为 Hive 设置 ODBC 连接。我按照以下步骤操作,但没有成功。 用户 DSN-->添加--> Hortonworks Hive ODBC 驱动程序--> 我提供了以下详细信息 主机:主
我找不到任何文档或示例。到目前为止,我可以成功连接,但是我不知道选择和返回数据的语法。 :odbc.start() {:ok, conn} = :odbc.connect('DSN=mydsn;UID
我正在阅读一篇有关数据透视缓存的 MS Excel 帮助文章,并想知道 OLE DB 和 ODBC 源 的含义 ...You should use the CommandText property i
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
从应用程序调用 SQLColAttribute 时出现 SQL_INVALID_HANDLE 错误(尝试与自行开发的 odbc 驱动程序通信)我不知道为什么句柄被声明为无效句柄,因为它是一个简单的结构
我有一个简单的 SQL,需要通过 ODBC 调用 RedShift。SQL是这样的 SELECT id as Tag From SomeView 这根本不起作用。它给了我错误 DataSource.E
我正在尝试使用 BIML 生成自动暂存区域。源数据库为Progress,通过ODBC连接。 我正在使用以下演练: https://www.cathrinewilhelmsen.net/2015/07/
我是一名优秀的程序员,十分优秀!