[freetds] "error_handler: Data-conversion resulted in overflow"

Peter Matulis pmatulis at gmail.com
Wed Sep 27 10:20:38 EDT 2006


On 9/26/06, James K. Lowden <jklowden at freetds.org> wrote:
> Peter Matulis wrote:
> > I currently have a Linux system successfully performing SELECT queries
> > on a MS SQL Server 2000 system.  However, I notice that sometimes I
> > get an error:
> >
> > "error_handler: Data-conversion resulted in overflow"
> >
> > I get this when I add a single column to a select statement.  That
> > column has bigint as datatype.
>
> That would come from src/ctlib/cs.c, line 650.  It's a bit messy: it
> writes to stderr instead of calling the client's error handler.  But it
> gets the point across, I suppose.
>
> > Does anyone know why this is happening
> > and how I can resolve it?
>
> I think you're trying to convert a BIGINT to a string (possibly
> implicitly, through binding).  The character buffer is not big enough.
>
> The conversion function that emits this message returns CS_FAIL.  That
> should be passed back to your application.

Thanks for your reply.  I'm using a very simple Perl script using the
DBI and DBD:Sybase modules.  I'm not a programmer and would really
appreciate detailed guidance on what I should do to fix this.  This is
my script where 'telephone' is the BIGINT:


#!/usr/bin/perl
#
use DBI;

my $user   = "BLAH";
my $passwd = "BLAH";

my $dbh = DBI->connect("DBI:Sybase:server=BLAH", $user, $passwd,
{PrintError => 0});

$dbh->do("use BLAH");

unless ($dbh) {
    die "Unable for connect to server $DBI::errstr";
}

my $sqlStatement = "

SELECT
        agent_id,
        telephone,
        city,
        country
FROM agents

";

$sth = $dbh->prepare($sqlStatement);
$sth->execute;
$rows = $sth->rows;
print "Rows returned: $rows\n";

while (( $agent_id
        ,$telephone
        ,$city
        ,$country) = $sth->fetchrow_array ) {
        printf("%s, ,%s ,%s ,%s\n",$agent_id,$telephone,$city,$country);
}

exit(0);



More information about the FreeTDS mailing list