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

777 views Asked by At

I am using Ubuntu 14.04 with freetds and unixODBC to connect to a 2008 Microsoft SQL Server. I tested the connection with tsql and isql and it worked correctly. While using isql -v if I include accents (á,é,í,ó,ú) in the query I receive the following response:

[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near '?'.

[ISQL]ERROR: Could not SQLExecute

While installing freetds and unixODBC packages I received a warning message saying that special characters would not be accepted unless an extra package was but I can't which one it was. To try and solve this problem I uninstalled freetds and unixODBC, reinstalled them and did not receive any warning message but I am still receiving the same error message when including accents in the queries.

PS: This is the first question I make so sorry if it is vague or incomplete.

1

There are 1 answers

1
Christian Potdevin On BEST ANSWER

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