[freetds] problems using FreeTDS 0.64 with DBD::Sybase 1.08 and SQL Server 2005

Alan Voss alanvoss at hotmail.com
Tue Sep 11 17:19:02 EDT 2007


Greetings,

After successfully installing version 0.64 of FreeTDS (and several previous offerings), I've come across a strange error.  Our systems are mostly SuSE Linux 10 systems, though we have a few newer Debian installs for good measure.  The problem is similar across all these servers.

When I compile FreeTDS 0.64 from source, one test fails:

-------------------BEGIN------------------------------
Trying cs_config with CS_USERDATA

Testing CS_SET/GET USERDATA with char array
Testing CS_SET/GET USERDATA with char array
Testing CS_SET/GET USERDATA with int
PASS: cs_config
All rows read, this may not occur.
cancel.c: Check asynchronous called ct_cancel()
More results?...
do_fetch retrieved 10000 rows
do_fetch() returned: 0
More results?...
FAIL: cancel
---------------------END----------------------------

When I do the installation routine for DBD::Sybase 1.08, several fail, although some failures are to be expected, per the DBD::Sybase README.freetds file:

----------------------BEGIN---------------------------
Failed Test   Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/exec.t        10  2560    22   18  81.82%  8-17 19-22
t/fail.t         5  1280    12    5  41.67%  4 6-7 11-12
t/main.t       255 65280    34   25  73.53%  21 23-34
t/multi_sth.t    2   512    43    2   4.65%  14 19
t/place.t        1   256    16    1   6.25%  13
t/thread.t       1   256    10    1  10.00%  10
t/xblob.t        4  1024    11    4  36.36%  4 6 10-11
---------------------------END----------------------


OS: SuSE Linux 10
Remote DB: SQL Server 2005
FreeTDS Version: 0.64
DBI version: 1.59
DBD::Sybase Version: 1.08

In the freetds.conf file (contrived for privacy):
[sqlserver2005]
        host = sqlserver2005.hostname.com
        port = 1433
        tds version = 8.0

The problem can be recreated using the following contrived table:

-----------BEGIN----------------------------------------
CREATE TABLE tds_test (
   id int,
   dt datetime,
   yr int
)
------------END----------------------------------------

And the following perl code.  Take special note that I'm trying to use undef, which should translate to NULL per the DBI specification.  All of the above fields are nullable (id, dt, yr).  I was simply trying to make a contrived case that could be easily replicated.

------------BEGIN-----------------------------------------
#!/usr/bin/perl -w

use strict;
use warnings;
use DBI;
use Data::Dumper;

my $dbh = DBI->connect(
    'DBI:Sybase:server=sqlserver2005',
    'username',
    'password',
);

my $sth = $dbh->prepare( q{
    UPDATE tds_test
    SET dt = ?, yr = ?
    WHERE id = ?
} );

$sth->execute( undef, undef, 110684130 ) || die DBI->errstr;
------------END------------------------------------------

The error produced is:

------------BEGIN------------------------------------------
out of memory for rpc row!DBD::Sybase::st execute failed: Server message number=8178 severity=16 state=1 line=2 server=sqlserver2005 text=The parameterized query '(@P1 varchar(80), at P2 varchar(80), at P3 varchar(80))
    UPDATE tds' expects the parameter '@P1', which was not supplied. at rpc_problem.pl line 24.
Server message number=8178 severity=16 state=1 line=2 server=sqlserver2005 text=The parameterized query '(@P1 varchar(80), at P2 varchar(80), at P3 varchar(80))
    UPDATE tds' expects the parameter '@P1', which was not supplied. at rpc_problem.pl line 24.
-------------END-----------------------------------------

When I update to one of the more recent FreeTDS snapshots, e.g. freetds-0.65.dev.20070910, without recompiling DBD::Sybase, the error disappears.  But then I can't recompile DBD::Sybase, without the following errors:

------------BEGIN--------------------------------------------------------------------------------
cc -c  -I/usr/local/include -DNO_BLK=1 -I/usr/lib/perl5/site_perl/5.8.7/i586-linux-thread-multi/auto/DBI -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -Wall -pipe   -DVERSION=\"1.08\" -DXS_VERSION=\"1.08\" -fPIC "-I/usr/lib/perl5/5.8.7/i586-linux-thread-multi/CORE"   Sybase.c
In file included from Sybase.h:50,
                 from Sybase.xs:14:
dbdimp.h:32: error: syntax error before âCS_BIGINTâ
dbdimp.h:32: warning: no semicolon at end of struct or union
dbdimp.h:32: warning: no semicolon at end of struct or union
dbdimp.h:33: warning: type defaults to âintâ in declaration of âubiâ
dbdimp.h:33: warning: data definition has no type or storage class
dbdimp.h:38: error: syntax error before âdâ
dbdimp.h:38: warning: type defaults to âintâ in declaration of âdâ
dbdimp.h:38: warning: data definition has no type or storage class
dbdimp.h:39: error: syntax error before âtâ
dbdimp.h:39: warning: type defaults to âintâ in declaration of âtâ
dbdimp.h:39: warning: data definition has no type or storage class
dbdimp.h:44: error: syntax error before â}â token
dbdimp.h:44: warning: type defaults to âintâ in declaration of âvalueâ
dbdimp.h:44: warning: data definition has no type or storage class
dbdimp.h:48: error: syntax error before â}â token
dbdimp.h:48: warning: type defaults to âintâ in declaration of âColDataâ
dbdimp.h:48: warning: data definition has no type or storage class
dbdimp.h:161: error: syntax error before âColDataâ
dbdimp.h:161: warning: no semicolon at end of struct or union
dbdimp.h:200: error: syntax error before â}â token
Sybase.c: In function âXS_DBD__Sybase__db__isdeadâ:
Sybase.c:111: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__db__date_fmtâ:
Sybase.c:130: warning: unused variable âixâ
Sybase.xs: In function âXS_DBD__Sybase__db_pingâ:
Sybase.xs:83: warning: implicit declaration of function âsyb_pingâ
Sybase.xs: In function âXS_DBD__Sybase__st_cancelâ:
Sybase.xs:95: warning: implicit declaration of function âsyb_st_cancelâ
Sybase.c:168: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__st_ct_get_dataâ:
Sybase.c:187: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__st_ct_data_infoâ:
Sybase.c:218: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__st_ct_send_dataâ:
Sybase.c:254: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__st_ct_prepare_sendâ:
Sybase.c:275: warning: unused variable âixâ
Sybase.c: In function âXS_DBD__Sybase__st_ct_finish_sendâ:
Sybase.c:294: warning: unused variable âixâ
Sybase.xs: In function âXS_DBD__Sybase__st_syb_describeâ:
Sybase.xs:188: error: dereferencing pointer to incomplete type
...
...
Sybase.xs:748: error: dereferencing pointer to incomplete type
Sybase.xs: In function âboot_DBD__Sybaseâ:
Sybase.xs:23: error: invalid application of âsizeofâ to incomplete type âimp_sth_tâ
make: *** [Sybase.o] Error 1
--------------END------------------------------------------------------------------------------


After pouring through documentation on perlmonks, FreeTDS mailing list, and DBD::Sybase's lists, I've come up dry.  In fact, searching for the error "out of memory for rpc row" on google only yields references to the FreeTDS code, but not how to fix them.  Any thoughts?

Alan Voss
Examinetics, Inc.

_________________________________________________________________
Gear up for Halo® 3 with free downloads and an exclusive offer. It’s our way of saying thanks for using Windows Live™.
http://gethalo3gear.com?ocid=SeptemberWLHalo3_WLHMTxt_2


More information about the FreeTDS mailing list