欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

CentOS下安装FreeTDS

程序员文章站 2022-05-07 21:30:14
分布式拒绝服务攻击(DDoS)指的是通过多台机器向一个服务或者网站发送大量看似合法的数据包使其网络阻塞、资源耗尽从而不能为正常用户提供正常服务的攻击手段。随着互联网带宽的增加和相关工具的不断发布,这种攻击的实施难度越来越低,有大量IDC托管机房、商业站点、游戏服务商一直饱受DDoS攻击的困扰,那么如... ......
导读

官方网站:http://www.freetds.org

下载地址:http://ibiblio.org/pub/linux/alpha/freetds/stable/freetds-stable.tgz

这个软件能够用linux和unix连接ms sqlserver和sybase数据库

安装与配置
  1. 首先下载freetds安装包到服务器

    wget -c http://ibiblio.org/pub/linux/alpha/freetds/stable/freetds-stable.tgz

    CentOS下安装FreeTDS

  2. 解压

    tar -zxvf freetds-stable.tgz

    CentOS下安装FreeTDS

  3. 编译安装

    1. 因为是编译安装所以确保机器有安装gcc(可使用yum进行安装)

      yum install gcc-c++
      yum install ncurses-devel
    2. 开始安装

      cd freetds-0.91/
      ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
      make && makeinstall

      解释: 安装freetds到目录/usr/local/freetds:--prefix=/usr/local/freetds 支持mssql2000:--with-tdsver=8.0 --enable-msdblib

    CentOS下安装FreeTDS

    CentOS下安装FreeTDS

    CentOS下安装FreeTDS

  4. freetds默认安装在/usr/local/freetds目录当中,库文件在相应的lib目录下。

    vim /etc/ld.so.conf加入一行 /usr/local/freetds/lib

  5. 然后运行以下指令使更改生效:

    ldconfig
  6. 测试连接

    tsql -h mssql服务器服务ip -p 1433 -u mssql服务器登陆帐号 -p mssql服务器登陆密码

    $  tsql -h xxxxxx-p 1433 -u sa -p xxxxxx -d test  
    locale is "zh_cn.utf8"  
    locale charset is "utf-8"  
    default database being set to test  
    1> select @@version  
    2> go  
    
    microsoft sql server 2008 r2 (rtm) - 10.50.1600.1 (intel x86)  
            apr  2 2010 15:53:02  
            copyright (c) microsoft corporation  
            data center edition on windows nt 5.1 <x86> (build 2600: service pack 3)  
    
    (1 row affected)
    问题

    adaptive server connection failed

    locale is "en_us.utf-8"
    locale charset is "utf-8"
    using default charset "utf-8"
    error 20017 (severity 9):
            unexpected eof from the server
            os error 115, "operation now in progress"
    error 20002 (severity 9):
            adaptive server connection failed
    there was a problem connecting to the server

    执行tsql -c

    [root@thinkpa freetds-0.91]# tsql -c
    compile-time settings (established with the "configure" script)
                                version: freetds v0.91
                 freetds.conf directory: /usr/local/etc
         ms db-lib source compatibility: no
            sybase binary compatibility: no
                          thread safety: yes
                          iconv library: yes
                            tds version: 5.0
                                  iodbc: no
                               unixodbc: no
                  sspi "trusted" logins: no
                               kerberos: no

    发现freetds的版本是5.0,考虑到可能是freetds版本的问题

    两种解决方式:

    1. 修改全局tds 版本号

      找到/usr/local/etc/freetds.conf修改[global]下面的tds version8.0

    2. 连接时修改tds版本号

      tdsver=7.0 tsql -h

      整个连接命令则变为:

      tsql -h mssql服务器服务ip -p 1433 -u mssql服务器登陆帐号 -p mssql服务器登陆密码

    adaptive server connection failed

    "cannot open server 'xxxxxxx' requested by the login. client with ip    address 'xxxxxxxxx' is not allowed to access the server.  to enable       access, use the windows azure management portal or run                   sp_set_firewall_rule on the master database to create a firewall       rule for this ip address or address range.  it may take up to five       minutes for this change to take effect."
    error 20002 (severity 9):
            adaptive server connection failed

    这个毋庸置疑了,找管理员开通白名单再访问吧!