码迷,mamicode.com
首页 > 数据库 > 详细

linux-mint 下添加 ODBC DRIVER

时间:2014-10-15 01:22:02      阅读:540      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   io   os   ar   for   

搬运自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 found
libssl.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 found
Checking for 64 bit Linux compatible OS ..................................... OK
Checking required libs are installed ................................. NOT FOUND
unixODBC utilities (odbc_config and odbcinst) installed ............ NOT CHECKED
unixODBC Driver Manager version 2.3.0 installed .................... NOT CHECKED
unixODBC Driver Manager configuration correct ...................... NOT CHECKED
Microsoft ODBC Driver 11 for SQL Server already installed .......... NOT CHECKED
Microsoft ODBC Driver 11 for SQL Server files copied ........................ OK
Symbolic links for bcp and sqlcmd created ................................... OK
Microsoft ODBC Driver 11 for SQL Server registered ................... INSTALLED

Install log created at /tmp/msodbcsql.6208.20652.13584/install.log.

One or more steps may have an *. See README for more information regarding
these 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 client
Driver =/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

标签:des   style   blog   http   color   io   os   ar   for   

原文地址:http://www.cnblogs.com/uranium/p/4025477.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!