Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Ravi Parimi <rparimi at gmail dot com>
Subject: Executing stored procedures on Remote SQL Server
Date: Jun 27 2005 10:12PM


 I have been using DBD::Sybase to execute stored procedures on a
remote SQL server and it worked great for some time.

However, it stopped working for recent builds of our software. I do
not understand how this is possible. I checked with the people
responsible for developing the stored procedure and they said nothing
has changed in its implementation. The stored procedure that I use
returns a text message and an integer indicating the success/failure
of the execution. I use the following to get these values:

	my $sql = <prepare($sql) || die "Can't prepare $sql : $DBI::errstr\n";
	if($@) {
		print "Prepare Error is $@\n";
		print "Printing error here ... $@\n";
		return $@;
	eval {
		$sth->execute or die "Can't execute ${sql}: $DBI::errstr\n";
	if($@) {
		print "Execute Error is $@\n";
		return $@;
	my ($code,$error) = $sth->syb_output_params();
	print "code = $code, error = $error\n";
	if($code == 0) {
		$ret = "Pass";
	} else {
		$ret = "Fail:$error";
	return $ret;

The stored procedure does not seem to return any values at all,
although I see that it was executed on the remote server( the stored
procedure sends data over the network to a remote server, and this is
how I am sure that it gets executed).

Is there a way to figure out why I am unable to get the output of the
stored procedures into the perl variables? When I execute it using SQL
query analayzer on the windows machine itself, it runs just fine and I
can see both the message and integer being set.

I find the same problem with the very latest DBD::Sybase 1.05_02 that
Michael released earlier today as well.

Many thanks,