Hi!

I've got a strange problem with DBD:Sybase,

We have a program written that goes into our SQL Server box and lists the 
active threads so that we can monitor it remotely. For the most part it 
works fine. We've used the same script using DBD:ODBC, and DBD:ODBC through 
the dbiproxy. We recently got the ability to have our linux box connect with 
DBD:Sybase, and while that works much better than the proxy did for multiple 
connections, it won't call finish(). The program just hangs. If you don't 
call finish() or disconnect, it does the same thing. The only way to end it 
is to call disconnect without calling finish(). Now, according to the 
cheetah book, that's not supposed to cause any problems, but it's messy, and 
gives us an annoying message saying "disconnect invalidates 1 active 
statement handle (either destroy statement handles or call finish on them 
before disconnecting).

Any ideas on what's wrong here? We don't get this error when we're not using 
DBD:Syabse. I suppose we could just disable that message, but, I'd rather 
find a way to fix the problem.

Thanks!!

David Sevier


#!/bin/perl

use DBI;
use SQLUtility;
use Getopt::Long;

my $connection  = "dbi:Sybase:sdcaecap02";
my $username    = "XXXXX";
my $password    = "XXXXX";


&GetOptions("dsn=s"      => \$connection
           ,"user=s"     => \$username
           ,"password=s" => \$password
           );

$Command = "dbcc sqlperf (threads)";

### Connect to the database
my $dbh = connectiontodb($connection,$username,$password);

### Create a new statement handle to fetch table information
my $database_schema=performsqlaction($dbh,$Command);

my $NumberofFields = $database_schema->{NUM_OF_FIELDS};


### Iterate through all the tables...
  foreach ( my $i = 0; $i < $NumberofFields; $i++) {
    my $name = $database_schema->{NAME}->[$i];
    printf "%-10s   ",$name ;
  }
  print "\n";

  foreach (my $i = 0; $i < $NumberofFields; $i++) {
    my $name = "=========";
    printf "%-10s   ",$name;
  }
  print "\n";

while (my $hash_ref = $database_schema->fetchrow_hashref() )
{

### Tidy up NULL fields
  foreach (my $i = 0; $i < $NumberofFields; $i++)
  {
    my $name = $database_schema->{NAME}->[$i];
    printf "%-10s   ", $hash_ref->{$name} ;
  }
  print "\n";
}
$database_schema->finish() or die "Can't finish it!\n";
$dbh->disconnect;

exit;
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to