2016-05-16 181 views
1

我無法通過用於Linux的Microsoft ODBC驅動程序連接到MS-SQL服務器。以下錯誤消息:Linux上的Microsoft SQL Server ODBC驅動程序Ubuntu 14.04:錯誤的庫版本

isql mydsn myuser mypw -v 

[01000][unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0' : file not found 

上面的消息並沒有說明整個故事。讓我們來看看LDD可以告訴我們:

ldd /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0 
/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0) 
/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0) 
     [...] 

(我是一個碼頭工人的圖像上安裝此,這樣Caravel可以連接到MS-SQL數據庫 - 看DockerfileDocker image爲卡拉維爾)

回答

2

的下文命令將安裝的的libstdC++ so.6正確版本(基於this answer):

echo 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main' > \ 
/etc/apt/sources.list.d/ubuntu-toolchain-r-test-trusty.list 
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F 
apt-get update -y 
apt-get upgrade -y 
apt-get dist-upgrade -y 

小號o如果你從頭開始在ubuntu 14.04上,這些命令將安裝UnixODBC,用於Linux的Microsoft SQL Server ODBC驅動程序和所有需要的依賴項:

echo 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main' > \ 
    /etc/apt/sources.list.d/ubuntu-toolchain-r-test-trusty.list && \ 
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F && \ 
    apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y && \ 
    apt-get install -y build-essential libssl-dev libffi-dev \ 
    curl ca-certificates libgss3 && \ 
    locale-gen en_US.utf8 && dpkg-reconfigure locales 

mkdir -p /tmp/ms-sql && (cd /tmp/ms-sql && curl 'https://download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz' \ 
    -H 'Referer: https://www.microsoft.com/en-us/download/confirmation.aspx?id=50419' --compressed | \ 
    tar --strip-components=1 -xzv && \ 
    sed -ri -e 's/wget/curl/g' -e's/(\s*)\$\(curl[^)]+\)/\1curl -fsSL "$dm_url" -o "$dm_package_path"/' \ 
    -e '/make install/,$ d' build_dm.sh && echo '(cd $tmp/$dm_dir && make install)' >> build_dm.sh && \ 
    echo YES | ./build_dm.sh --accept-warning --libdir=/usr/lib/x86_64-linux-gnu && \ 
    ./install.sh install --accept-license) && \ 
    sed -rie 's/\[.+SQL Server\]/[MS-SQL]/' /etc/odbcinst.ini 
相關問題