如何在Linux中安装freetds? [英] How to install freetds in Linux?

查看:477
本文介绍了如何在Linux中安装freetds?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Ubuntu连接到MSSQL服务器.我已经在建议的此处.

I am trying to connect to MSSQL server from Ubuntu. I have installed freetds like suggested here.

但是,当我尝试配置/etc/odbc.ini并输入驱动程序路径时,位置/usr/local/freetds/lib/libtdsodbc.so上没有驱动程序.

However, when I try to configure /etc/odbc.ini and enter a driver path I have no driver at location /usr/local/freetds/lib/libtdsodbc.so.

有人可以帮助我安装freetds并配置odbc来使用它吗? * edit1:我在/usr/lib/x86_64-linux-gnu/odbc中找到了libtdsodbc.so.我应该使用该驱动程序/路径吗?

Can someone help me to install freetds and to configure odbc to use it? *edit1: I have found libtdsodbc.so in /usr/lib/x86_64-linux-gnu/odbc. Should I use that driver/path?

推荐答案

我创建了一个Vagrant框,其中具有完整的安装示例: https://github.com/FlipperPA/django-python3-vagrant/

I've created a Vagrant box which has a full installation example here: https://github.com/FlipperPA/django-python3-vagrant/

...但是这里是基本步骤.

...but here are the basic steps.

# Install pre-requesite packages
sudo apt-get install unixodbc unixodbc-dev freetds-dev freetds-bin tdsodbc

将odbcinst.ini指向/etc/odbcinst.ini中的驱动程序:

Point odbcinst.ini to the driver in /etc/odbcinst.ini:

[FreeTDS]
Description = v0.91 with protocol v7.2
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

在odbc.ini中创建您的DSN:

Create your DSNs in odbc.ini:

[dbserverdsn]
Driver = FreeTDS
Server = dbserver.domain.com
Port = 1433
TDS_Version = 7.2

...以及freetds.conf中的DSN:

...and your DSNs in freetds.conf:

[global]
    # TDS protocol version, use:
    # 7.3 for SQL Server 2008 or greater (tested through 2014)
    # 7.2 for SQL Server 2005
    # 7.1 for SQL Server 2000
    # 7.0 for SQL Server 7
    tds version = 7.2
    port = 1433

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)
;   dump file = /tmp/freetds.log
;   debug flags = 0xffff

    # Command and connection timeouts
;   timeout = 10
;   connect timeout = 10

    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.  
    # Try setting 'text size' to a more reasonable limit 
    text size = 64512

# A typical Microsoft server
[dbserverdsn]
    host = dbserver.domain.com
    port = 1433
    tds version = 7.2

完成此操作后,您可以尝试通过尝试与tsql(以测试FreeTDS层)和isql(用于通过FreeTDS堆栈的unixODBC)连接来测试您的连接.

After completing this, you can test your connection by attempting to connect with tsql (to test the FreeTDS layer) and isql (for the unixODBC through FreeTDS stack).

这篇关于如何在Linux中安装freetds?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆