Freetds - Tsql Connects, Isql Fails

FreeTDS - tsql connects, isql fails

The issue was this line in odbc.ini

Servername = 192.168.163.1

It should have been SQLEXPRESS which I think points to the name of the server configured in freetds.conf

Using FreeTDS and UnixODBC. Able to connect but cannot execute any SQL commands from isql or RODBC

It took me a LONG time to properly configure unixODBC with TDS, but for what it's worth, this set of instructions was my saving grace and what finally allowed me to get it working:

http://www.unixodbc.org/doc/FreeTDS.html

Pay particular attention to the second that references this command:

odbcinst -i -s -f tds.datasource.template 

It's where my biggest problem resided. What happened was I was doing this as root (which is fine), but if you read carefully it indicates that every user that uses the driver has to run this command to 'register' the connection for their userid. Once I ran the same command under each other user, everything worked fine (since my actual code doesn't run as root).

One other thought... a quick and easy test to see if the connection is actually working with TDS (even before you try the ODBC piece) is to run bcp and export a really small table.

Try something like this, just to rule out the TDS install being the issue.

freebcp <database>.dbo.<tablename> out $HOME/foo.out -c -t '|' \
-S <hostname>:<port> -U <userid> -P <password>

It's a shame Microsoft and Unix don't play nicer together.

Using freetds and unixODBC to run queries with accents (á,é,í,ó,ú) on SQL Server

After trying for a long while the solution I found was quite simple and worked with tsql and isql. On the data source file for unixODBC I needed to set TDS_Version=8.0.

The file before:

[MSSQL]

Driver = FreeTDS

Server = XXX.XXX.XXX.XXX

Port = XXXX

Database = name

The new file:

[MSSQL]

Driver = FreeTDS

Server = XXX.XXX.XXX.XXX

Port = XXXX

TDS_Version = 8.0

Database = name



Related Topics



Leave a reply



Submit