Executing stored procedures on Remote SQL Server

Ravi Parimi <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <[email protected]>
Hi, 

 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 = <<SQL;
	declare \@exit_rc int, \@exit_text varchar(2000);
exec master.dbo.ing_bulk_load_setup '$job', '$op', 
'$dbname', '$owner', '$base_t', '$input_t', '$output_t', '$tblspc',
$batch, \@exit_rc output, \@exit_text output;
SQL
	my $sth;
	print "SQL is \n$sql\n";
	eval {
		$sth = $dbh->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,
--ravi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.