FreeTDS Installation: Creating DSN for MS-SQL in Ubuntu

Installation of FreeTDS

FreeTDS is a open source implementation of Tabular Data Stream Protocol, used to connect to a number of RDBMS.

Install the following packages in ubuntu

sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-dev sqsh

We need to append/create the following files

  1. /usr/share/freetds/freetds.conf
  2. /etc/odbcinst.ini
  3. /etc/odbc.ini

sudo vi /usr/share/freetds/freetds.conf
[MSSQL]
host = 192.168.0.1
port = 1433
tds version = 7.0

To test if the freeTDS is working fine, use tsql to connect to RDBMS.
Note that the TDS Version is related to SQL server (version). 2007 MSSQL is version 7.0. By default, TDS is set to 5.0

TDSVER=7.0 tsql -H IP_ADDR -p PORT_NO -U USERNAME -P PASSWORD -D DATABASE_NAME

You can lookup the location of the driver using the following command.
find /usr/ -type f -name libtds*

sudo vi /etc/odbcinst.ini
[FreeTDS]
Description = FreeTDS driver
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup=/usr/lib/i386-linux-gnu/odbc/libtdsS.so
FileUsage = 1
UsageCount = 1

sudo vi /etc/odbc.ini
[MSSQL]
Description = MS SQL Server
Driver = FreeTDS
Server = IP_ADDR
UID = USERNAME
PWD = PASSWORD
ReadOnly = No
Port = PORT_NO

Test your final DSN with the following command
isql -v MSSQL username password

Note: Please do not leave space at the beginning of the line while editing these files. DSN will not be configured otherwise.

Feel free to report any corrections.

Lemmatization

Lemmatization is a process of finding inflected words that can have similar meaning. It can be identified, grouped together and treated as a single word in the same context.

For example:

(Drank, drinking, drunk) -> drink

(Great, better, best) -> good

Python:

from nltk.stem.wordnet import WordNetLemmatizer

Java: (Stanford NLP)

import java.util.*;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.ling.CoreAnnotations.*;