我已经尝试在 Ubuntu 中运行“Microsoft ODBC Driver 13 for SQL Server”两天了,但我没有想法/已经筋疲力尽了谷歌。
我的测试机器是一个 vagrant 虚拟机,这些是 bash 脚本的相关部分,它充当配置器:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install -y python-software-properties vim curl libgss3 libstdc++6 git-core libpcre3-dev make
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
和
cd /home/vagrant
wget https://download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz
tar xvzf msodbcsql-13.0.0.0.tar.gz
sudo chmod +x msodbcsql-13.0.0.0/build_dm.sh
sudo chmod +x msodbcsql-13.0.0.0/install.sh
./msodbcsql-13.0.0.0/build_dm.sh --accept-warning
directory=$(ls /tmp | grep 'unixODBC')
path="/tmp/$directory/unixODBC-2.3.1"
cd $(echo $path)
sudo make install
cd /home/vagrant/msodbcsql-13.0.0.0/
sudo ./install.sh install --accept-license
sudo ln -s /usr/lib64/libodbcinst.so.2 /lib/x86_64-linux-gnu/libodbcinst.so.2
cat << EOF | sudo tee -a /home/vagrant/.odbc.ini
[MSSQL]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0
Server=<my_server>\<my_sqlserver_instance_name>,1433
Database=PDS
Threading=1
UsageCount=1
EOF
sudo chown vagrant:vagrant /home/vagrant/.odbc.ini
这是安装日志的相关位:
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on libmsodbcsql-13.0.so.0.0
[Fri Apr 22 20:16:59 UTC 2016] Copying install.sh to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on install.sh
[Fri Apr 22 20:16:59 UTC 2016] Copying build_dm.sh to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on build_dm.sh
[Fri Apr 22 20:16:59 UTC 2016] Copying README to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on README
[Fri Apr 22 20:16:59 UTC 2016] Copying LICENSE to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on LICENSE
[Fri Apr 22 20:16:59 UTC 2016] Copying WARNING to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on WARNING
[Fri Apr 22 20:16:59 UTC 2016] Copying INSTALL to /opt/microsoft/msodbcsql/13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on INSTALL
[Fri Apr 22 20:16:59 UTC 2016] Copying bin/bcp.rll to /opt/microsoft/msodbcsql/13.0.0.0/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on bcp.rll
[Fri Apr 22 20:16:59 UTC 2016] Copying bin/SQLCMD.rll to /opt/microsoft/msodbcsql/13.0.0.0/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on SQLCMD.rll
[Fri Apr 22 20:16:59 UTC 2016] Copying bin/BatchParserGrammar.dfa to /opt/microsoft/msodbcsql/13.0.0.0/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on BatchParserGrammar.dfa
[Fri Apr 22 20:16:59 UTC 2016] Copying bin/BatchParserGrammar.llr to /opt/microsoft/msodbcsql/13.0.0.0/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on BatchParserGrammar.llr
[Fri Apr 22 20:16:59 UTC 2016] Copying lib64/msodbcsqlr13.rll to /opt/microsoft/msodbcsql/13.0.0.0/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on msodbcsqlr13.rll
[Fri Apr 22 20:16:59 UTC 2016] Copying docs/en_US.tar.gz to /opt/microsoft/msodbcsql/13.0.0.0/docs/en_US
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on en_US.tar.gz
[Fri Apr 22 20:16:59 UTC 2016] Copying include/msodbcsql.h to /opt/microsoft/msodbcsql/13.0.0.0/include
[Fri Apr 22 20:16:59 UTC 2016] Setting permissions on msodbcsql.h
[Fri Apr 22 20:16:59 UTC 2016] Extracting documentation from /opt/microsoft/msodbcsql/13.0.0.0/docs/en_US/en_US.tar.gz
...
[Fri Apr 22 20:16:59 UTC 2016] Creating symbolic links
[Fri Apr 22 20:16:59 UTC 2016] Linking bcp to bcp-13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Linking sqlcmd to sqlcmd-13.0.0.0
[Fri Apr 22 20:16:59 UTC 2016] Registering the Microsoft ODBC Driver 13 for SQL Server driver
odbcinst: Driver installed. Usage count increased to 1.
Target directory is /etc
ldd 显示满足所有依赖项:
vagrant@vagrant-ubuntu-trusty-64:~$ ldd /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0
linux-vdso.so.1 => (0x00007ffd109e8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fde5d698000)
libodbcinst.so.2 => /lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007fde5d486000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fde5d280000)
libgss.so.3 => /usr/lib/libgss.so.3 (0x00007fde5d074000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fde5cda9000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fde5c9cc000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fde5c76d000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fde5c460000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fde5c159000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fde5bf42000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fde5bd24000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fde5b95e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fde5dc8e000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fde5b754000)
libshishi.so.0 => /usr/lib/libshishi.so.0 (0x00007fde5b4fa000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fde5b2ca000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fde5b0c6000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fde5aebb000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fde5acb6000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fde5aa9b000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fde5a886000)
libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007fde5a5c8000)
libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007fde5a348000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fde5a142000)
libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007fde59f0f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fde59cf5000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fde59ab3000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fde598ab000)
当我尝试测试驱动程序时,这是响应:
vagrant@vagrant-ubuntu-trusty-64:~$ isql -v MSSQL sa <password>
[28000][unixODBC][Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'.
[ISQL]ERROR: Could not SQLConnect
在 SQL Server 错误日志中,我有这个:
2016-04-22 13:35:04.52 Logon Error: 18456, Severity: 14, State: 8.
2016-04-22 13:35:04.52 Logon Login failed for user 'sa'. Reason: Password did not match that for the login provided. [CLIENT: <my_ip>]
我可以使用 sa 用户登录到命名服务器,并使用 Microsoft SQL Server Management Studio 登录“SQL Server 身份验证”,所以我不认为这是一个“Windows 身份验证”问题,这似乎是此错误严重性的标准答案-状态组合。
我不知道从这里去哪里。任何帮助是极大的赞赏!!!
“Microsoft ODBC Driver 13 for SQL Server”不适用于 isql。您必须使用 sqlcmd。使用 sqlcmd 连接和使用 sqlcmd 实用程序比 sqlcmd 手册页要好得多。
要使用 DSN:
DSN: