Skip to Content.
Sympa Menu

freetds - Re: freetds_0.51, DBD::Sybase...connected, but no working statement handle

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark Stantz" <stantz AT panix.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: freetds_0.51, DBD::Sybase...connected, but no working statement handle
  • Date: Tue, 3 Apr 2001 17:48:38 -0400



No-one ever responded to the appended message, but I was
able to get things working by migrating all of my software to a
Linux box and repeating my build process as described, specifying
'tds7.0' in $SYBASE/interfaces. From this I conclude that
freetds-0.51 is "not there yet" under Solaris 7/gcc.

-mfs
------------
> Greetings, all.
>
> I'm trying to use FreeTDS and DBD::Sybase to access an MS SQL
> Server 7 database from my Solaris box. I am able to connect to the remote
> database, but can't seem to actually access any table data, because I can't
> seem to get a working statement handle (yes, I am calling $sth->execute
> before calling $sth->fetch_array.) I was wondering if anyone on this list
> has seen a problem like mine before.
>
> I've built freetds-0.51 using:
> ./configure --prefix=$HOME/TDS --with-tdsver=7.0
> gmake
> gmake install
>
> No problems during the build. I had to use gmake rather than make
> to avoid the 'fatal: relocation error...symbol g_tds_err_handler' problem.
> Because of this, I also used 'gmake' when building DBD::Sybase. (Building
> it with 'make' doesn't seem to change or help anything, either.)
>
> DBD::Sybase was built using:
> setenv SYBASE $HOME/TDS
> setenv LD_LIBRARY_PATH $SYBASE/lib
> perl Makefile.PL
> gmake
> gmake install
>
> No problems. DBD::Sybase warns that the -lcs, -ltcl and -lcomn
> libraries aren't found, but adds that this is probably harmless. Other
> than this, there are no warnings or errors in any of my builds.
>
> My interfaces file entry (indented with tabs, not spaces) for the
> server in question looks like this:
>
> ---------------------------------------------------------------------------
> intersection
> query tcp tds5.0 147.11.57.32 1433
> master tcp tds5.0 147.11.57.32 1433
> ---------------------------------------------------------------------------
>
> For some reason, if I try 'tds7.0' rather than 'tds5.0' I cannot
> connect to the database. Since I apparently must use 'tds5.0', I tried
> rebuilding FreeTDS using '--with-tdsver=5.0', but this didn't help.
>
> The script I'm using to connect to the database looks like this:
> ---------------------------------------------------------------------------
> require DBI;
> require DBD::Sybase;
>
> $ENV{'SYBASE'} = $ENV{'HOME'} . "/TDS";
>
> print "Connecting...\n";
> &connect("dbi:Sybase:server=intersection;database=hris",
> "sa", "<censored>");
>
> sub connect {
> my($dsn, $user, $pass) = @_;
> my($dbh, $sth);
> my($query) = <<EOF;
> select * from hris_phone_list
> EOF
>
>
> $dbh = DBI->connect($dsn, $user, $pass);
> if (!defined $dbh) {
> print "Connect failed:\n$DBI::errstr\n";
> } else {
> $sth = $dbh->prepare($query);
> if (!defined $sth) {
> print "Error calling \$dbh->prepare:\n$DBI::errstr\n";
> $dbh->disconnect;
> return;
> }
>
> $sth->execute;
> print "$DBI::errstr\n"; # Be sure $sth->execute isn't complaining.
>
> while (@data = $sth->fetchrow_array) {
> foreach (@data) {
> print "$_ ";
> }
> print "\n";
> }
>
> $sth->finish;
> $dbh->disconnect;
> }
> }
>
> I know that I'm connecting to the database successfully, because
> if I deliberately corrupt either the username or password in the &connect
> call, I get a connection failure message from DBI->connect. However, when
> I connect successfully, no matter what my query is (legal or illegal SQL),
> I get the error message: "no statement executing at /folk/mstantz/tdstest
> line 36." Line 36 is the $sth->fetchrow_array call. I am used to seeing
> this error message only when I forget to call $sth->execute before
> $sth->fetchrow_array, but that's not the case here. $sth->execute seems
> to be failing silently, as $DBI::errstr is empty after it's called.
>
> Additional information: Solaris 7, perl 5.6.0, DBI 1.14.
>
> So...am I missing something here? Any advice anyone can provide
> would be very much appreciated. I am beginning to suspect the problem may
> lie on the server side...which would be unfortunate, since I am NT-
> illiterate.
>
> Thanks for taking the time to read and consider this.
>
> Mark Stantz
> stantz AT panix.com
> mstantz AT windriver.com



  • Re: freetds_0.51, DBD::Sybase...connected, but no working statement handle, Mark Stantz, 04/03/2001

Archive powered by MHonArc 2.6.24.

Top of Page