Tolga Ceylan | 30 Oct 05:10 2014

timeout handling and server msg callback

Hi All,

Recently, I've stumbled on a potential issue with the timeout handling
in ct_lib.

Given these two cases of SQL executing;

DECLARE  <at> counter int
WHILE ( <at> counter < 99999999)
    PRINT  <at> counter
    SET  <at> counter =  <at> counter + 1


DECLARE  <at> counter int
WHILE ( <at> counter < 99999999)
    SET  <at> counter =  <at> counter + 1

(only difference is print or no-print basically)

seems to affect timeout handling since this trips the ::select() (aka
tds_select) based query timeout.

In other words, continuously feeding such server messages back to the
client bypasses
the query timeout. The issue is tricky because there has to be enough
(Continue reading)

Turk, Scott A | 27 Oct 17:48 2014

Output from SQL Server database

Hi, we're having a problem with the output we're getting across an Oracle link to a SQL Server database.  The
column output appears to have inserted nulls in between each character.  The data type of the column is
nvarchar.  Our application is SQL Developer.

Any ideas on what may be going wrong?  We also use FreeTDS to link to other SQL Server databases and have not
seen this happen previously.


Scott Turk
Database Analyst, DBA
Computer Services - MIS
Missouri State University
SATurk <at><mailto:SATurk <at>>
(417) 836-6195
润青杨 | 23 Oct 16:14 2014

freetds have some ssl security problems

Hi guys,
Recently, our group are trying to find ssl security problems by static
anlysis. Now we have find some problems in freetds-bin and report this bugs
to the launchpad, but we haven't receive any responses.
Could you please take a look at this bug:
Randy Syring | 8 Oct 01:07 2014

help with "login packet rejected"

I have a system that has been running against a QA MSSQL 2005 server 
(SQL7) without problems for a day or so.  I switched it over to our 
production MSSQL 2005 server (SQL1) and I can't get connected.  My 

log.c:196:Starting log file for FreeTDS 0.91
     on 2014-10-07 19:03:24 with debug flags 0x4fff.
config.c:714:Setting 'dump_file' to '/tmp/freetds.log.2802' from $TDSDUMP.
iconv.c:330:tds_iconv_open(0x2055d20, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:349:setting up conversions for client charset "UTF-8"
iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to port 1433 (TDS version 7.1)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:310:tds_open_socket() succeeded
util.c:156:Changed query state from DEAD to IDLE
net.c:741:Sending packet
0000 12 01 00 34 00 00 00 00-00 00 15 00 06 01 00 1b |...4.... ........|
0010 00 01 02 00 1c 00 0c 03-00 28 00 04 ff 08 00 01 |........ .(......|
0020 55 00 00 00 4d 53 53 51-4c 53 65 72 76 65 72 00 |U...MSSQ LServer.|
0030 f2 0a 00 00            -                        |....|

util.c:331:tdserror(0x1da8790, 0x2055d20, 20004, 104)
dblib.c:7929:dbperror(0x260a6a0, 20004, 104)
dblib.c:7981:20004: "Read from the server failed"
(Continue reading)

James Fisher | 7 Oct 20:18 2014

Re: SQL Anywhere 11 and FreeTDS

While reviewing the old thread I found that someone(Mr. James Lowden)
requested a tcpdump in order to capture a 'proper' disconnect but I didn't
see that the OP followed up.

I have attached mine here. If this isn't the right information, please let
me know. Thanks again to anyone willing to help.

On Mon, Oct 6, 2014 at 1:57 PM, James Fisher <ganoopluslinux <at>>

> OP:
> Hello, I am new to mailing lists, so sorry if it's bad that I am reviving
> this old thread - but I am having the same issue as this guy from several
> years back...
> I setup a few debian and ubuntu servers to talk to our database(Sybase SQL
> Anywhere 11) using sqsh and adodb(php) with FreeTDS. Once configured to
> use TDS v5.0, both sqsh and adodb can connect and execute queries on the
> database. However, when I began looking at the log on the server I found
> that each time either application disconnects, it shows a message like:
> >Connection terminated abnormally
> >Disconnected TCPIP client's AppInfo: HOST=debian-vm;PID=2605
> The database doesn't *seem* affected - as far as I can tell...
> The statements return the rows or insert the data.
(Continue reading)

Roger Hill | 4 Oct 10:04 2014

Netezza and named pipes

My first post to the list: please be gentle!

I need to copy a large volume of data every day from a Netezza database to
several other SQL server databases.

I have a solution that works: I use isql to extract to a named pipe, pass the
output through a couple of 'cut' steps to remove unwanted bits and pieces, and
then land the data on disk into a temporary file. I then use freebcp to load
it to the SQL server database. But it's convoluted, and I'm looking for a
better way.

Two questions come out of this: Firstly  I know that freebcp did not support
input from named pipes as recently as 2011; is there support for named pipes

And secondly, something like 'datacopy' between heterogeneous databases (in my
case Netezza to SQL server) would eliminate a lot of mucking about on the
intermediate box. Any chance of something like that?

Any other suggestions?

Roger Hill

Roger Hill
Yavuz Gökırmak | 3 Oct 16:21 2014

"SET FMTONLY ON select .." locks table

Hi all,

I am using freetds to do bulk load from linux to mssql,
it is interesting that we get some problem during "SET FMTONLY ON.." query,
it is just getting table columns but somehow it gets the table lock and
blocks other bulk load operations..

do you have any idea,
is it possible to disable this "set fmtonly" query and give table column
names manually instead..

util.c:156:Changed query state from IDLE to QUERYING
write.c:139:tds_put_string converting 73 bytes of "SET FMTONLY ON select *
from clickstream.dbo.clicks_t SET FMTONLY OFF"
write.c:167:tds_put_string wrote 146 bytes
util.c:156:Changed query state from QUERYING to PENDING
net.c:743:Sending packet
0000 01 01 00 9a 00 00 01 00-53 00 45 00 54 00 20 00 |........ S.E.T. .|
0010 46 00 4d 00 54 00 4f 00-4e 00 4c 00 59 00 20 00 |F.M.T.O. N.L.Y. .|
0020 4f 00 4e 00 20 00 73 00-65 00 6c 00 65 00 63 00 |O.N. .s. e.l.e.c.|
0030 74 00 20 00 2a 00 20 00-66 00 72 00 6f 00 6d 00 |t. .*. . f.r.o.m.|
0040 20 00 65 00 76 00 61 00-6d 00 63 00 6c 00 69 00 | .......... ..c.l.i.|
0050 63 00 6b 00 73 00 74 00-72 00 65 00 61 00 6d 00 |c.k.s.t. r.e.a.m.|
0060 2e 00 64 00 62 00 6f 00-2e 00 63 00 6c 00 69 00 |..d.b.o. ..c.l.i.|
0070 63 00 6b 00 73 00 5f 00-74 00 20 00 53 00 45 00 |c.k.s._. t. .S.E.|
0080 54 00 20 00 46 00 4d 00-54 00 4f 00 4e 00 4c 00 |T. .F.M. T.O.N.L.|
(Continue reading)

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)