Welcome 微信登录

首页 / 数据库 / MySQL / Linux 配置 unixODBC 访问 MS SQL Server 说明

一.安装 unixODBC

这个使用YUM安装一下,不多说:Linux 使用光盘搭建 本地 YUM 服务器 http://www.linuxidc.com/Linux/2012-02/55466.htm[root@rac1 mnt]# yum install unixODBC     [root@rac1 mnt]# yum install unixODBC-devel 确认unixODBC的安装,使用 isql命令,其是unixODBC自带的命令。可以使用这个命令验证unixODBC的配置。 [root@rac1 /]# isql --versionunixODBC 2.2.14[root@rac1 /]# which isql/usr/bin/isql[root@rac1 /]# isql *********************************************** unixODBC - isql                            ************************************************ Syntax                                     **                                            **     isql DSN [UID [PWD]] [options]       **                                            ** Options                                    **                                            ** -b        batch.(no prompting etc)        ** -dx       delimit columns with x          ** -x0xXX    delimit columns with XX, where  **           x is in hex, ie 0x09 is tab     ** -w        wrap results in an HTML table   ** -c        column names on first row.      **           (only used when -d)             ** -mn       limit column display width to n ** -v        verbose.                        ** -lx       set locale to x                 ** -q        wrap char fields in dquotes     ** -3        Use ODBC 3 calls                ** -n        Use new line processing         ** --version version                         **                                            ** Commands                                   **                                            ** help - list tables                         ** help table - list columns in table         ** help help - list all help options          **                                           ** Examples                                   **                                            **     isql WebDB MyID MyPWD -w < My.sql    **                                            **     Each line in My.sql must contain     **     exactly 1 SQL command except for the **     last line which must be blank (unless **     -n option specified).                **                                            ** Please visit;                              **                                            **     http://www.unixodbc.org              **     pharvey@codebydesign.com             **     nick@easysoft.com                    *********************************************** [root@rac1 /]# 

二.安装 FreeTDS

freeTDS官网地址:http://www.freetds.org/FreeTDS is a setof libraries for Unix and Linux that allows your programs to natively talk toMicrosoft SQL Server and Sybase databases.--FreeTDS是Unix 和Linux library的一个集合,通过FreeTDS可以连接到MicrosoftSQL Server 和 Sybase DB。 

2.1 下载freeTDS:

[root@rac1 ~]# wget http://ibiblio.org/pub/Linux/ALPHA/freetds/current/freetds-current.tgz--2012-03-06 10:14:43-- http://ibiblio.org/pub/Linux/ALPHA/freetds/current/freetds-current.tgzResolving ibiblio.org... 152.19.134.40Connecting toibiblio.org|152.19.134.40|:80... connected.HTTP request sent, awaiting response... 200OKLength: 2192516 (2.1M) [application/x-gzip]Saving to: a€?freetds-current.tgza€? 100%[==========================================================>]2,192,516   43.7K/s   in 37s     2012-03-06 10:15:21 (58.5 KB/s) -a€?freetds-current.tgza€? saved [2192516/2192516]2.2 安装freeTDS:FreeTDS 的安装帮助,可以参考:unixODBC - MS SQL Server/PHPhttp://www.unixodbc.org/doc/FreeTDS.html [root@rac1 ~]# tar xzf freetds-current.tgz --查看configure的帮助文档:[root@rac1 freetds-0.92.dev.20120305]# ./configure --help --官网提供的方法:
# ./configure --with-tdsver=8.0--with-unixodbc=/usr/local 
# make 
# make install 注意这里:如果 unixODBC是源码安装, 则–with-unixodbc=/usr/local
如果 unixODBC是rpm安装, 则不需要该选项 我们的unixODBC 是通过RPM包安装的,所以这里我们省略这个选项,直接configure。 # ./configure --with-tdsver=8.0 --prefix=/usr/local/freetds --enable-msdblib  --with-gnu-ld  --enable-shared  --enable-static--这次configure成功。这里我们将freetds 安装到/usr/local 目录下。 然后make:# make 
# make install 

2.3 配置环境变量

将freetds的库文件所在路径配置到LD_LIBRARY_PATH参数中: 
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/freetds/lib/: 

设置bin路径 
$vi /root/.bashrc 
添加内容如下: 
export FREETDS=/usr/local/freetds 
export $PATH="$PATH:$FREETDS/bin" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/freetds/lib
  • 1
  • 2
  • 3
  • 下一页
MySQL自动更新时间的触发器让MySQL Server打印trace日志相关资讯      数据库 
  • 数据库范式详解  (06/20/2014 08:59:37)
  • rman 创建catalog实验及说明  (10/07/2012 19:00:24)
  • SYSTEM用户删除后怎么重新创建和原  (09/09/2012 10:00:38)
  • 分布式数据库:dblink  (10/27/2012 15:57:32)
  • AutoMySQLBackup实现数据库定期备  (09/14/2012 08:08:02)
  • 利用dbstart和dbshut脚本自动启动  (08/21/2012 06:16:21)
本文评论 查看全部评论 (0)
表情: 姓名: 字数