- FreeTDS is a free implementation of the TDS (Tabular Data Stream).
- Includes three client libraries: DB-Library, CT-Library, and ODBC
- To use tsql : $ sudo apt-get install freetds-bin
Free TDS
$ wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
$ tar -zxvf freetds-stable.tgz
$ cd freetds-0.91/
Configuration
#./configure --with-tdsver=7.0 --prefix=/usr/local/freetds
#make
#make install
#export SYBASE=/usr/local/freetds
#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/freetds/lib
Forma 1:
# apt-get install unixodbc unixodbc-bin
Estos comandos instalara esto:
/etc/odbc.ini
/etc/odbcinst.ini
Instalar tdsodbc
$ apt-get update
$ apt-get install tdsodbc
Este comando instalara esto:
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
/usr/share/tdsodbc/odbcinst.ini
drivers for both FreeTDS and ODBC in a single package
Tenemos varias formas de instalar freetds
$ apt-get install freetds-bin
ftp://ftp.freetds.org/pub/freetds/stable/ descargar la version deseada
# wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.9.tar.gz
# tar xvfz freetds-stable.tgz
# cd freetds-0.82
# ./configure --with-tdsver=5.0 --with-unixodbc=/usr
# make
# make install
# make clean
Si durante la instalacion de freetds manual, se da estos mensajes :
- No acceptable C compiler found in $PATH when installing python
redhat base: # yum groupinstall "Development tools"
Debian base: # apt-get install build-essential
- configure: error: sql.h not found
sudo apt-get install unixodbc-dev
- freetds all-recursive error 1
$ sudo apt-get install libtool autoconf
$ autoreconf -f -i
=== Configuracion ===
- freetds-dev does not include tsql
Show configure
```bash
$ tsql -C
These commands connects me to the database:
$ tsql -S MyServer -U username@servername -P password
$ tsql -S serverhost -U dbowner -P dbpassword
$ sqsh -S serverhost -U dbowner -P dbpassword
$ tsql -LH
== srcs == http://ngiriraj.com/work/handy-guide-for-free-tds-installation-in-linux/ http://notes.brazen.ca/freetds-and-odbc-on-ubuntu.html http://johnjianfang.blogspot.pe/2011/04/freetds-linux-client-for-ms-sql-server.html http://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.apdv.cli.doc/doc/t0061216.html http://www.bictor.com/2014/05/13/configure-unixodbc-for-ubuntu-14-04-using-freetds/ http://onefinepub.com/2014/03/installing-unixodbc-2-3-2-higher-ubuntu-12-04-lts/ ftp://ftp.freetds.org/pub/freetds/stable/
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver =/usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup =/usr/lib/i386-linux-gnu/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
To access MSSQL from *nix, install
$ sudo apt-get -y install freetds-dev tdsodbc freetds-bin unixodbc
$ tsql -S serverhost -U dbowner -P dbpassword
// Or sqsh (freetds-dev does not include tsql)
$ sqsh -S serverhost -U dbowner -P dbpassword
$ TDSVER=7.0 tsql -H hillary -p 4100 -U sa
Password:
1>
$ 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: yes
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
$ nano /usr/local/etc/freetds.conf
.
.
A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
[xxxxxxXXxxx]
host = xx.xxx.x.x
tds version = 5.0
port = 2638
[XxxxxxXxxxx]
host = xx.xx.xx.xx
Port=1117
tds version=5.0
Test the connection by using the isql utility
$ isql -v test
$ isql -v serverinstance user pwd
$ /etc/freetds/freetds.conf
For php
$ apt-get install php5-odbc
====install freetds for expert===
$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
OR
$ wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
$ tar xzvf freetds-stable.tgz
$ cd freetds-0.XX/
./configure --with-unixodbc=/usr --with-tdsver=8.0
make
sudo make install
src: http://richbs.org/post/43142767072/connecting-to-microsoft-sql-server-from-unix