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> gmail.com>

> OP: http://thread.gmane.org/gmane.comp.db.tds.freetds/11976
> 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?


[1] http://msdn.microsoft.com/en-us/library/ms178158.aspx;
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> www.example.com

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.