Stuart Henderson | 28 Jun 23:19 2016

sqsh build fails with FreeTDS 1.0

sqsh build is failing with newer FreeTDS. There's an easily fixed
CS_TDS_80 that can be replaced with CS_TDS_71, but when that's done
I run into this in src/dsp_conv.c:

     * Take the existing format and strip it down according to the
     * type of date that we are processing and replace the ms
     * field if it exists.
#if defined(CS_BIGDATETIME_TYPE) && defined(CS_BIGTIME_TYPE)
    if (dt_fmt->datatype == CS_BIGDATETIME_TYPE || dt_fmt->datatype == CS_BIGTIME_TYPE)
        fmt = dsp_datetime_strip( dt_fmt->datatype, conv_fmt, (int) dr.datesecfrac );
        fmt = dsp_datetime_strip( dt_fmt->datatype, conv_fmt, (int) dr.datemsecond );

- CS_BIGDATETIME_TYPE etc are now defined, but the structure
doesn't include datesecfrac:

dsp_conv.c: In function 'dsp_datetime_conv':
dsp_conv.c:665: error: 'CS_DATEREC' has no member named 'datesecfrac'

Any suggestions for a better fix than just #if 0'ing it out?
John Kendall | 22 Jun 17:01 2016

Re: bcp -n -E fails on identity column

My last attempt to report this was a bit muddled.  Here's another try.  
Using version 1.00.6.

Using the bcp -n (native file format) and -E (retain identity values) options together produces:

   Msg 20060, Level 11
   Unknown datatype encountered

   Error in bcp_colfmt col 1

I see this happening on Sybase (11 & 16) and MS SQL 2008.  

Test to reproduce:

   select id_col=identity(5) into tempdb..tbl   -- Sybase
   select id_col=identity(int) into tempdb..tbl  -- MS SQL

   $ freebcp tempdb..tbl out tbl.bcp -S $DSQUERY -U usr -P pw -n -E
   Msg 20060, Level 11
   Unknown datatype encountered

   Error in bcp_colfmt col 1

datacopy also has a problem with the -E option, I assume the problems are related.

Fabrice Manfroi | 22 Jun 16:12 2016

Build error on AIX 6/7 with freeTDS 1.00.6 (current stable)


I'm trying to build the last stable freeTDS sources but it fails with
the following compilation errors:

tls.c:719: error: 'AF_INET6' undeclared (first use in this function)
tls.c:719: error: (Each undeclared identifier is reported only once
tls.c:719: error: for each function it appears in.)
tls.c:722: error: 'AF_INET' undeclared (first use in this function)

It seems that an include of the sys/socket.h header is missing.

I propose the attached patch to fix the problem.

Best Regards.

FreeTDS mailing list
FreeTDS <at>
Adam Baratz | 21 Jun 23:45 2016

version detection

Following up on my pdo_dblib thread, I'd like to be able to detect which
version of FreeTDS is installed. So I can know when the dbnextrow()
workaround should be used instead of dbcanquery(). As far as I can tell,
the version only gets exposed through dbversion(), which is a string I'd
have to parse.

Nem W Schlecht | 16 Jun 22:20 2016

Another defncopy patch - check dbopen results

I have another defncopy patch to fix another issue.  The results from
dbopen() are just checked with an assert() call.  Thus, if I type in
the wrong database name, username, whatever, I get a core dump that I
have to clean up from a typo on my part.  What do you all think of a
quick check/message/exit, similar to what happens with tsql?

Patch attached.  Just checks to see if dbproc has a value.  If not,
prints an error message and exit(1)s.  Otherwise, continues on.

I deal with a lot of servers and a lot of usernames/passwords, so this
one hits me fairly often.


Nem W Schlecht
 "Perl did the magic.  I just waved the wand."
Attachment (defncopyfix-20160616.patch): application/octet-stream, 721 bytes
FreeTDS mailing list
FreeTDS <at>
Adam Baratz | 16 Jun 18:18 2016

dbcanquery() with pdo_dblib


I'm looking at fixing this bug with the PHP pdo_dblib extension:

I have it built to use FreeTDS to communicate with MSSQL.

My understanding from the docs is that dbcanquery() does what's needed
here. Basically, it should be called before using dbresults() to get the
next rowset[1]. However, that doesn't seem to resolve the issue. The call
succeeds, but the call to dbresults() will then fail. What I've found works
is fetching the rows manually:


while (ret == SUCCESS) {
ret = dbnextrow(H->link);

I don't want to do anything with these rows, so I'd rather not do this. Am
I missing something basic about how dbcanquery() is supposed to be used?


Nem W Schlecht | 12 Jun 19:59 2016

Old dblib.c bug still there

Hello all,

First off, I just want to thank all of the developers in this community for
continuing work on such a useful and excellent application.  I cannot thank
and appreciate you all enough!  Thank you, Thank You, THANK YOU!!

I recently grabbed the last stable release and came across an issue that
seems to constantly be plaguing me and has been around for a long time.  I
had reported this back in July of 2014, but the proposed solution
(stripping all but one space) would still screw up some of my stored
procedures (that have lots of spaces in strings for formatting purposes).

My original post and reply:

The issue is with lines 7311-7314 in dblib.c:

   7311                 case NTBSTRINGBIND: /* strip trailing blanks, null
term */
   7312                     while (srclen && src[srclen - 1] == ' ') {
   7313                         --srclen;
   7314                     }

Looks like something good to do, right?  Get rid of any blanks that we
don't need.  However, this keeps messing up my output when I use "defncopy"
to dump out some of my stored procedures.

If it just so happens that you have a large stored procedure or large
string in that stored procedure *and* there are one or more spaces exactly
(Continue reading)

Merle Reinhart | 10 Jun 16:10 2016

Re: OSX distribution


That tarball fixes the compile issue at least on Mac OS X 10.11.x (El Capitan).  Thanks!!!

It turns out the problem would only occur when compiling FreeTDS with iodbc.  It was fine compile with
unixodbc.  I finally tracked down 'why' it occurs.

In iodbc, the sql.h include calls sqltypes.h which calls iodbcunix.h which has a conditional definition
of BYTE:
#if defined (OBSOLETE_WINDOWS_TYPES)    
typedef unsigned char		BYTE;

In unixodbc, the sql.h include calls sqltypes.h which contains an unconditional definition of BYTE:
typedef unsigned char		BYTE;

So, the compile would fail using iodbc apparently due to OBSOLETE_WINDOWS_TYPES not being defined
anywhere, but would work using unixodbc.

I was just about to report the exact same issue when I saw Ryan's mail.

Again, thank you very much for all the work.


> Message: 6
> Date: Fri, 10 Jun 2016 11:59:50 +0100
> From: Frediano Ziglio <freddy77 <at>>
> To: FreeTDS Development Group <freetds <at>>
> Subject: Re: [freetds] OSX distribution
(Continue reading)

Mark Nienberg | 6 Jun 21:24 2016

Minimum versions for MS Azure SQL

I have been connecting to a local MS SQL database via PHP-pdo with FreeTDS
for some time using CentOS 6. In this case the PHP is 5.3.3 and the FreeTDS
is 0.91 from the EPEL repository. Now I need to make a similar connection
to a MS SQL database hosted on the Microsoft Azure cloud. I have not been
able to do so with the above versions.

I also tested on a CentOS 7 machine, which has PHP 5.4.16 and FreeTDS 0.95.
Again I did not succeed.

I suppose the issue is related to this PHP - FreeTDS interaction:

which seems to indicate a fix in PHP version 5.5.

So then I upgraded the PHP on a test CentOS 6 machine to 5.6 using the Remi
repository, but that didn't work either, so the problem may be the older
FreeTDS on that machine.

Does anyone know the minimum versions of PHP and FreeTDS that will connect
to Azure?


Igor Korot | 8 Jun 05:21 2016

Remote connection

Hi, list,
This is my first post here with the question and I'm sure it is a
stupid question.
But unfortunately I have absolutely 0 experience with DB Administration.

I installed SQL Server 2012 Express on my Windows 8.1 laptop, and I am able to
connect to it from the localhost using ODBC  connection from Server Management

Now I'm trying to get connection from the Linux machine with freeTDS.
I currently have 0.91 installed on my Linux box (Gentoo) which is latest.
I can successfully ping both ways by IP address. However when I try to
run "busybox telnet 1433" the machine just sits there.
There is no FW running on the Windows box at the moment for the testing

Since ping works and I can access the web I presume that the network is set
up properly.

So now my question is: is there an option in MS SQL to tell it to accept remote

Thank you for any pointers.
Andy Wakefield | 31 May 19:38 2016

Re: version 1.0


Great news on releasing 1.0, and many, many thanks to you and all who 
have worked so hard to make this excellent software available!

One quick question - is git the only way to download version 1.0? I 
checked the website, and the "latest stable release" is still coming up 
with 0.95.

Andy Wakefield