我正在设置一个Docker构build,这将允许我从Linux连接到SQL Server。 据我所知,与这个问题几乎没有任何关系,但可能,因为我很困惑!
我将Debian的形象从Debian转移到Debian上,因为Debian是小而轻的。 我怀疑我错过了一些locale的东西,这是什么原因,但我不知道。
无论如何,这是我的命令+错误:
$ perl -MDBI -MData::Dumper -E'say Dumper(DBI->connect("dbi:ODBC:server=10.6.6.17;port=1433;database=Lynx;driver=ODBC Driver 11 for SQL Server;uid=sa;pwd=password")->selectall_arrayref("SELECT * FROM Setup"))' terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid
对我来说,这看起来像一个C + +错误,这可能与SQL Server ODBC驱动程序有关; 它可能是C ++。
我努力了:
export LC_ALL=C export LC_ALL=C.UTF-8 export LC_ALL=en_US.UTF-8 export LC_ALL=en_US export LC_ALL=POSIX apt-get install locales locale-gen 并取得了零进展。 有任何想法吗?
附录:以下是我的实际Dockerfile; 它肯定是不完整的,可以使用一些爱,但它可能会帮助你重现这个错误(注意,我的命令中的连接string将需要调整,以指向一个真正的SQL Server最终,但不要重现这个问题。)
FROM perl:5.20.1 RUN wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.2.tar.gz && \ tar xf unixODBC-2.3.2.tar.gz && \ cd /root/unixODBC-2.3.2 && \ ./configure --disable-gui --disable-drivers --enable-stats=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE && \ make && \ make install && \ echo "include /usr/local/lib" >> /etc/ld.so.conf && \ ldconfig RUN ln -s /usr/local/lib/libodbc.so.2 /usr/lib/libodbc.so.1 && \ ln -s /usr/local/lib/libodbccr.so.2 /usr/lib/libodbccr.so.1 && \ ln -s /usr/local/lib/libodbcinst.so.2 /usr/lib/libodbcinst.so.1 && \ ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.10 && \ ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.10 RUN wget http://download.microsoft.com/download/B/C/D/BCDD264C-7517-4B7D-8159-C99FC5535680/RedHat6/msodbcsql-11.0.2270.0.tar.gz && \ tar xf msodbcsql-11.0.2270.0.tar.gz && \ cd /root/msodbcsql-11.0.2270.0 && \ bash install.sh install --force --accept-license RUN wget https://cpan.metacpan.org/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.50.tar.gz && \ tar xf DBD-ODBC-1.50.tar.gz && \ cd /root/DBD-ODBC-1.50 && \ perl Makefile.PL -u && \ cpanm --installdeps . && \ make && \ make test && \ make install
我想到了!
我需要遵循以下步骤:
export DEBIAN_FRONTEND=noninteractive apt-get install locales echo "en_US.UTF-8 UTF-8" > /etc/locale.gen locale-gen
然后剩下的工作!