首页 > 代码库 > linux-mint 下添加 ODBC DRIVER
linux-mint 下添加 ODBC DRIVER
搬运自https://code.google.com/p/odbc/wiki/InstallingMicrosoftDriverOnDebianLinux,做了些小修改
安装必要的 odbc library
sudo apt-get install libodbc1
下载微软的sql driver for Red Hat 6(Dibian也可以用,只是需要做些调整)
wget http://download.microsoft.com/download/B/C/D/BCDD264C-7517-4B7D-8159-C99FC5535680/RedHat6/msodbcsql-11.0.2270.0.tar.gz
然后进入下载目录解包
$ tar xf msodbc*$ cd msodbc*
由于这个driver是给Red Hat 用的,debian下的一些依赖库就不能被侦测到。需要做一些符号链接来让它找到依赖库的位置
查看缺少的依赖库
$ ldd lib64/libmsodbcsql-11.0.so.2270.0 | grep not
输出应该是
libcrypto.so.10 => not foundlibssl.so.10 => not found
建立符号链接
$ cd /usr/lib/x86_64-linux-gnu$ sudo apt-get install libssl-dev$ sudo ln -s libssl.so.1.0.0 libssl.so.10$ sudo ln -s libcrypto.so.1.0.0 libcrypto.so.10
再次重复之前的步骤检查依赖库,应该没有了
之后就是就入安装目录执行自带的安装脚本
$ sudo bash ./install.sh install --force
输出如果是
./install.sh: line 233: rpm: command not foundChecking for 64 bit Linux compatible OS ..................................... OKChecking required libs are installed ................................. NOT FOUNDunixODBC utilities (odbc_config and odbcinst) installed ............ NOT CHECKEDunixODBC Driver Manager version 2.3.0 installed .................... NOT CHECKEDunixODBC Driver Manager configuration correct ...................... NOT CHECKEDMicrosoft ODBC Driver 11 for SQL Server already installed .......... NOT CHECKEDMicrosoft ODBC Driver 11 for SQL Server files copied ........................ OKSymbolic links for bcp and sqlcmd created ................................... OKMicrosoft ODBC Driver 11 for SQL Server registered ................... INSTALLEDInstall log created at /tmp/msodbcsql.6208.20652.13584/install.log.One or more steps may have an *. See README for more information regardingthese steps.
看起来好多问题啊...不过好像没有什么关系
接下来运行
sqlcmd -S localhost
输出应该是
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired.Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : TCP Provider: Error code 0x274D.
说明microsoft library 已经安装完成
接下来创建一个文本文件
[MSSQL]Description = Official native clientDriver =/usr/local/lib/libmsodbcsql-11.0.so.2270.0
保存为tds.driver.template2
然后
sudo odbcinst -i -d -f tds.driver.template2 odbcinst: Driver installed. Usage count increased to 1. Target directory is /etc
安装完成
linux-mint 下添加 ODBC DRIVER
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。