Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a Solaris box, trying to connect to a remote SQL Server 7 running on a WinNT box.

I've installed the following on my Solaris box:

No errors during install. I am able to use the 'tsql' tool found in the bin dir of freeTDS to connect to my remote MS SQL Sever.

However, I can't seem to get DBD::Sybase to work. I've gotten a number of software error messages to display, when I try using the following CGI code:

#!/usr/local/bin/perl # use DBI; my $DB_Server = "DBServer"; my $DB_User = "gues"; my $DB_Pass = "test"; print "DB_Server:[$DB_Server] DB_User:[$DB_User] DB_Pass:[$DB_Pass]"; BEGIN { $ENV{SYBASE} = '/usr/local/freetds/'; } my $dbh = DBI->connect("dbi:Sybase:server=$DB_Server", $DB_User, $DB_P +ass, {PrintError => 0}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth; $sth = $dbh->prepare("select \@\@servername"); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } $dbh->disconnect();

The most recent error message was:
DBD::Sybase initialisation failed: Had to create DBD::Sybase::dr::imp_data_size unexpectedly at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 713. (in cleanup) dbih_getcom handle DBI::dr=HASH(0xa34fc8) is not a DBI handle (has no magic) at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 713. (in cleanup) dbih_getcom handle DBI::dr=HASH(0xa34fc8) is not a DBI handle (has no magic) at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 537. at /var/apache/htdocs/test.cgi line 14

Do I have an error with DBD::Sybase? Should I try an earlier version? Could there be a missing link? or ENV setting? Any thoughts? Feedback? Assistance?

Thanks!

Replies are listed 'Best First'.
Re: DBD::Sybase Woes
by busunsl (Vicar) on Sep 17, 2002 at 06:00 UTC
    I have never seen the error, but here are a few hints:

    Is 'gues' the correct user? Or did you mean 'guest'?

    BEGIN { $ENV{SYBASE} = '/usr/local/freetds/'; } does NOT work as expected! Look here for a working version.

    And the usual thing: use strict and warnings!

    hth

      the login and password were just put there to "protect the innocent". Regards of which, it doesn't even get that far to give me an error with the login/pw. The error suggests that the DBD::Sybase module was either not loaded 100%, missing something, or not working. I've tried to contact the creator of that package, but no response yet. I'll try adding in your suggestion of the ENV variable. Though - I'm thinking that today I may try to remove/re-install the module. Maybe even try an earlier version of it. Thanks