Error While Trying to Fetch a row
am 04.11.2005 20:03:34 von ithier
------_=_NextPart_001_01C5E172.7490E208
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
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.
=20
I received the following error, while trying to fetch a row.
=20
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.
=20
A copy of the perl program is:
=20
#!/usr/local/bin/perl -w
use warnings;
use strict;
use DBI;
use CGI qw(:standard);
BEGIN {
$ENV{SYBASE} =3D '/usr/local/sybase';
}
my ($dbh, $sth, $sql);
print header;
print start_html ("Data View Program");
my $line =3D "*" x 40, "
";
print <
serif"> Flights Database
Data
View For tblflights Table
$line
inputform
$dbh =3D DBI -> connect
("dbi:Sybase:server=3DDB1;database=3Dfights;timeout=3D240", =
"opns",
"flights")
or die ("Cannot connect: DBI::errstr");
$sql =3D qq(SELECT * FROM flights.opns.tblflights); =20
=20
$sth =3D $dbh->prepare($sql);
$sth->execute() || die "Could not execute query $DBI::errstr";
my $counter =3D 1;
do {
while (my $record =3D $sth->fecth) {=20
print "$counter: ";
for my $field (@$record){
print "$field";
}
$counter++;
print "
";
}
}while ($sth->{syb_more_results});
=20
$sth->finish();
$dbh->disconnect || die "Failed to disconnect\n";
print "Goodbye
";
print end_html;
=20
------_=_NextPart_001_01C5E172.7490E208--
Re: Error While Trying to Fetch a row
am 04.11.2005 20:25:16 von tshinnic
At 13:03 11/4/2005, you 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
Since you mention the word 'flights' several times but only once mention 'fights', I'd guess you typed the wrong database name.
>Can't locate object method "fecth" via package "DBI::st" at
>/usr/local/apache/cgi-bin/fetch2.cgi line 35.
Since the name of the program is "fetch2.cgi", I bet you wanted to 'fetch' rather than 'fecth'ing.
So, two typos, two error messages. Can you see what the 'problem' is here?
>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, "
";
>print <
>
>
> Flights Database
Data
>
> View For tblflights Table
$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 "
";
> }
>}while ($sth->{syb_more_results});
>
>$sth->finish();
>
>$dbh->disconnect || die "Failed to disconnect\n";
>
>print "Goodbye
";
>print end_html;
Re: Error While Trying to Fetch a row
am 04.11.2005 20:37:27 von gonzales
I think you mispelled "fecth" should be "fetch"???
On Fri, 4 Nov 2005, ithier@jdi.army.mil 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, "
";
> print <
>
>
> Flights Database
Data
>
> View For tblflights Table
$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 "
";
> }
> }while ($sth->{syb_more_results});
>
> $sth->finish();
>
> $dbh->disconnect || die "Failed to disconnect\n";
>
> print "Goodbye
";
> print end_html;
>
>
>
--
/********** Louis Gonzales ***********\
/****** http://www.linuxlouis.net ****\
/**** louis.gonzales@linuxlouis.net **\
/****** HP Certified Professional ****\