2 things might be wrong here, and the error message is
correct. Notice this:
Can't locate object method "fecth"...
You want to use "fetch"...not "fecth" - notice the spelling.
The other thing that might be wrong is this:
$dbh = DBI -> connect
("dbi:Sybase:server=DB1;database=fights;timeout=240", "opns",
"flights")
or die ("Cannot connect: DBI::errstr");
Looks like you are trying to connect to database "fights" -
shouldn't that be "flights"?
HTH.
Hardy Merrill
>>> On 11/4/2005 at 3:03 PM, <[EMAIL PROTECTED]> wrote:
I am using SYBASE ASE 12_2, Perl5.8.5, DBI-1.48 and I just loaded
DBD::Sybase 1.04 on a UNIX/Solaris System.
I received the following error, while trying to fetch a row.
DBD::Sybase - can't change context to database fights
Can't locate object method "fecth" via package "DBI::st" at
/usr/local/apache/cgi-bin/fetch2.cgi line 35.
A copy of the perl program is:
#!/usr/local/bin/perl -w
use warnings;
use strict;
use DBI;
use CGI qw(:standard);
BEGIN {
$ENV{SYBASE} = '/usr/local/sybase';
}
my ($dbh, $sth, $sql);
print header;
print start_html ("Data View Program");
my $line = "*" x 40, "<br>";
print <<inputform;
<center>
<h1><font color="#0000CC" size="4" face="Times New Roman, Times,
serif"><strong><em> Flights Database <br>Data
View For tblflights Table</em></strong></font></h1>$line
inputform
$dbh = DBI -> connect
("dbi:Sybase:server=DB1;database=fights;timeout=240", "opns",
"flights")
or die ("Cannot connect: DBI::errstr");
$sql = qq(SELECT * FROM flights.opns.tblflights);
$sth = $dbh->prepare($sql);
$sth->execute() || die "Could not execute query $DBI::errstr";
my $counter = 1;
do {
while (my $record = $sth->fecth) {
print "$counter: ";
for my $field (@$record){
print "$field";
}
$counter++;
print "<br>";
}
}while ($sth->{syb_more_results});
$sth->finish();
$dbh->disconnect || die "Failed to disconnect\n";
print "<center>Goodbye<br>";
print end_html;
The email domain address for NYS DHCR has changed. As of June 16th, 2008 our
new email address is [EMAIL PROTECTED]
We ask that you begin using [EMAIL PROTECTED] immediately and to correct your
address book to reflect this new address.