Skip to Content.
Sympa Menu

freetds - Re: [freetds] Parameter Passing failing for tds version <> 4.3

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Parameter Passing failing for tds version <> 4.3
  • Date: Mon, 11 Oct 2010 08:45:31 +0200

2010/10/10 <sales AT minixel.com>

> I have been using freetds and DBD-Sybase as the cornerstone of my app since
> many years ago. There is a bug in freetds or maybe something by design that
> should be changed, that makes parameter-passing for stored procedures fail
> using any "tds version" different than 4.2. I consulted Mike Peppler, the
> author or DBD-Sybase, and presented him with a definitive proof of the
> issue, and also I submitted a DBI-trace with both cases, when it works and
> when it does not. He answered this "Please raise this with the FreeTDS
> group
> - there's not much I can do, because the trace doesn't even show that the
> data comes back to the application. Sorry."
> If somebody could investigate the issue, I have a Linux box ready with the
> Perl script, which I copy below:
> ------------------
> use strict;
> use DBI;
>
> my $dbh = DBI->connect("dbi:Sybase:development:1433", 'user', 'pwd',
> {PrintError => 0});
> die "Unable for connect to server $DBI::errstr"
> unless $dbh;
> $dbh->do("use $db");
> my $query = "declare \@param1 varchar(15), \@param2 money exec test_sql
> \@param1 OUTPUT, \@param2 OUTPUT";
> my $sth = $dbh->prepare($query);
> DBI->trace(5);
> $sth->execute();
>
> do {
> while(my $dat = $sth->fetch) {
> print "TYPE $sth->{syb_result_type}\n";
> print "Data @$dat[0] , @$dat[1] , @$dat[2] \n";
> if($sth->{syb_result_type} == 4042) { # it's a PARAM result
> print "Number: $dat->[0] \n";
> print "Varpar: $dat->[1] \n";
> }
> }
> } while($sth->{syb_more_results});
>
>
> $sth=undef;
> $dbh->disconnect;
> -----------
> The stored procedure is also very simple:
>
> create procedure test_sql
> @param1 varchar(15)=null out,
> @param2 money =0 out
> as
> set nocount on
> select @param1='Freetds', @param2 =56.60
> Return
>
> The issue is that this works flawlessly only with "tds version=4.2" and it
> fails with any other version, like 8.0, which I use for SQL Server 2008. Is
> it Freetds, DBI or DBD-Sybase?
>
> Thanks
> Federico
>
>
None of the above... the problem is the server!
This is a known problem (and perhaps should go to our FAQs). Microsoft
changed the protocol not returning output parameters passing language
request (that is normal queries). You have to use RPC calls at protocol
level (I don't remember how to issue such queries using DBD::Sybase).

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page