Matt Grimm | 24 Sep 22:28 2014

nvarchar(max) field in result set identified as WVARCHAR, not WLONGVARCHAR


When I use SQLColAttributeW(... SQL_DESC_CONCISE_TYPE ...) to ask FreeTDS
for the type of an nvarchar(max) column in my result set, it calls it a
SQL_WVARCHAR (-9). However, when I ask it for the type of an ntext field,
it calls it a SQL_WLONGVARCHAR. Since nvarchar(max) is the replacement for
ntext[1], shouldn't FreeTDS return -10 as the type of nvarchar(max) too?


venkata krishna Thaluru | 19 Sep 20:00 2014

[unixODBC][FreeTDS][SQL Server]Only one between SERVER, SERVERNAME and DSN can be specified

Hi All,
I am getting below error and while connecting to mssql.

[unixODBC][FreeTDS][SQL Server]Only one between SERVER, SERVERNAME and DSN
can be specified

I have checked the code in freeTDs ,We are checking whether we have
configured one ,then we are throwing this error.

Could you please let me know ,if i missed any configuration in any file.

Thanks in advance

Venkata Krishna
Andrew Rousseau | 16 Sep 21:07 2014

ODBC, MSSQL, FreeTDS inner join not returning data from second table

I have FreeTDS installed on an Ubuntu 14.04 server. I am connecting to the
MSSQL database as follows:

$db = new PDO('odbc:Driver=FreeTDS; Server=<IP Address>; Port=1433;
Database=db_name; UID=user; PWD=password;');

I am running the following query:

SELECT c.*, ct.*
FROM Committee AS c
INNER JOIN CommitteeType as ct on c.CommitteeTypeID=ct.CommitteeTypeID
WHERE CommitteeID=$committee_id

Then I am running:

$statement = $db->prepare($query);
$result = $statement->fetchAll(PDO::FETCH_NAMED);

The resulting array is very much what would be expected except that the
values from the CommitteeType table are all empty. When I run the exact
same query in Navicat on the database I get values for everything from the
second table.

Is there something buggy about this driver?

I have tried many variations on the query syntax without any difference in
output. It appears that I can never get values from an inner joined table
regardless of which tables I am querying.

(Continue reading)

Raila, Wayne F. | 16 Sep 16:31 2014

kerberos credentials not detected by FreeTDS

I am having trouble getting FreeTDS to pick up my kerberos credentials when connecting to MS SQL Server.
Client is a VirtualBox running CentOS. I have joined my virtual machine to the Windows domain, and I have
logged in to the virtual machine with a domain account. I am able to connect to the sql server using my
windows credentials, provided I specify username and password.

What I am not able to do is have FreeTDS detect my current kerberos credentials and use those automatically.
I am also not able to get FreeTDS to use a kerberos context that was loaded from a keytab file.

I am able to connect using tsql as long as I supply the username. Using this command, I am prompted for my
password, after which the connection succeeds.
tsql -S ftdsdsn -U 'MYDOMAIN\myusername'
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"

I would like to connect using just the dsn name, and have FreeTDS detect the existing kerberos credentials.
When I try this I get Error 20002 (severity 9) Adaptive Server connection failed.
tsql -S ftdsdsn
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20002 (severity 9):
        Adaptive Server connection failed
There was a problem connecting to the server

I can verify credentials using klist.
Ticket cache: FILE:/tmp/krb5cc_16777216_A8R0lC
(Continue reading)

Andrew Rousseau | 15 Sep 03:44 2014

MAMP, FreeTDS, ODBC, and ssh tunnel port forwarding almost working...

I am attempting to connect with php to a remote mssql server. Since the
mssql server is behind a firewall, I am using ssh tunnel with port
forwarding to access it from my Macbook.

$ ssh -N -L 1433:<mssql_server_ip>:1433 username <at>

The tunnel works fine as I am able to use Navicat to connect to the mssql
server and I am able to telnet to it. I think I have freetds and odbc
installed correctly and running under MAMP locally. It is only php that is
unable to connect to the server. Which leads me to believe that there is
some small piece of my configuration that is causing it to fail. I also am
thinking that the tunnel and port forwarding may be an issue for freetds.

From php I am attempting to connect the same way I am successfully
connecting on my linux production server:

$db = new PDO('odbc:Driver=FreeTDS; Server=; Port=1433;
Database=db_name; UID=user; PWD=password;');

Here is the output of a tdsdump:

$ TDSDUMP=/tmp/freetds.log TDSVER=7.1 tsql -H -p 1433
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not exist
OS error 61, "Connection refused"
There was a problem connecting to the server

(Continue reading)

venkata krishna Thaluru | 10 Sep 20:12 2014

share me 64 bit latest code and TDS version

Hi All,
Could you please share me the exact link for downloading the latest source
code for 64 bit  and share steps also.

Thanks in advance .

Venkata Krishna
Yeung, Alinga | 10 Sep 19:16 2014

Request to map Sybase status code '3604' to SQLSTATE '01000'


We use Sybase. We are porting our software to use Freetds. We come across a status code mapping from Sybase to
Freetds that results in a behavioural discrepancy in our software. 

In src/tds/mem.c, the Sybase status code '3604' is mapped to SQLSTATUS '23000'. This is causing our
software to fail.  

Sybase status code '3604' does not require any action to be taken. Our software treats the status code as
informational/warning and does not take any action. 

SQLSTATE '23000' indicates an error instead.

Locally we have changed mem.c to map the Sybase status code '3604' to '01000' which is a general warning, and
our software works fine.

We would like to request that Sybase status code '3604' be mapped to an informational SQLSTATUS, e.g. '01000'.

Thank you.

John Anderson | 29 Aug 18:50 2014

FreeTDS + SQL Server 2012 + UTF-16LE

Hello!  I'm wondering if you had any tips on how to work with characters
larger than 0xFFFF?  We currently have the problem where we try to
insert/update a row in the database and it gets truncated at the character
and creates an invalid syntax:

For example this character:   \U0001f44d

We've tracked this down to the fact that FreeTDS is trying to convert this
to UCS-2 rather than UTF16-LE, which is what SQL Server 2012 uses.

For example if we say:

INSERT INTO table(name) VALUES(N' Hello \U0001f44d')

We get the error:

Unclosed quotation mark after the character string 'Hello ' because it
stops processing the rest of the query.

Is there a freetds.conf or environment setting we can use to tell it to use
UTF-16LE instead of UCS2 so that we can accept these larger character sets?

As a temporary solution we've started sending the raw UTF-16LE bytes to
FreeTDS but we prefer not having to do this.

Falk Morgenroth | 28 Aug 09:28 2014

Config parameter to start DB on Sybase ASA personal server

DB: Sybase ASA 10 (Adaptive Server Anywhere) on Windows 7 
Client: Debian Wheezy, freetds, php (odbc_connect() ) 
ODBC:   unixodbc 

I can connect to the database by using unixodbc / freetds driver as long it is running. (started by a ERP
windows client app) I get all data I need with php - everything is working fine. 

Unfortunately I can not connect to the database when it was stopped by the client app. (on close of the app) 

The Sybase personal server (EngineName) is still running and is waiting to receive DatabaseName and
DatabaseFilePath to start the DB again. 
- Sybase ASA is configured for AUTOSTART. 
- Firewall does not block 
- Tests with a windows machine, ODBC and Sybase driver work - its possible to start the DB by using the ODBC

I figured out that I need to submit following parameter (which are available in Windows ODBC confiuration)
when connecting: 
EngineName=MyPersonalDBServer     --> Name of the personal server (Sybase calls it personal) 
DatabaseName=MyDatabase                --> Name of the database to start 
DatabaseFile=D:\mydatabasefile.db    --> Windows Path where database file is located on the hosting

Unfortunately I can not find a solution to do this by unixodb / freetds. I tried to add above parameter to
odbc.ini but freetds.log shows that it does not know / use these parameter 


(Continue reading)

venkata krishna Thaluru | 19 Aug 17:40 2014

Unable to load the driver

Hi All,

I am connecting to MSSQL from sybase using freetds .I m getting the below
like unable to load the driver

i have configured the odbc.ini
Servername =RemoteSQLServer

host =
port = 1433
tds version = 8.0

Can you please share if i am missing any configuration details .

Venkata krishna
Nunzio Luigi Puleio | 17 Aug 22:06 2014

latest FreeTDS on Centos 6.4 and latest SQL Server DB

Hello everyone!

I have CentOS 6.4 64bit webserver and a SQL Server 2008 DB.
I communicate with SQL Server with unixODBC but looks like it's not really
So I tried to set in odbc.ini TDS_Version = 9.0 and it started to be a bit
more performant.
BUT since doing tsql -C I see TDS Version as 4.2 so I guess it isn't really
performant so I am here asking you if to be more performant shall I have to
do makefile with latest freetds sources with patrameter  --with-tdsver=
*VER *settled as 7.2 ?

Thanks in advance.