The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help! "Bus error" and "CPU Panic" box wont boot hcclnoodles SUN Solaris 3 10-05-2006 05:38 PM
shared object "undefined symbol: fstat" error marcus121 High Level Programming 5 04-24-2006 08:11 PM
dbx error ("Executable contains object file compiled on ...") Sabari Nath S High Level Programming 0 08-04-2005 06:03 PM
Error : "No data written to object that was write locked" nileshkarania UNIX for Dummies Questions & Answers 1 06-07-2003 12:29 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-23-2007
rawat_me01 rawat_me01 is offline
Registered User
  
 

Join Date: May 2007
Posts: 3
Can't locate object method "fetchrow_array" Error

Hi,
I have a perl script which is interacting with Database.

I have following line of code :
=================================================

sub BEGIN
{
#use Getopt::Std;
#getopt ('S');
#($STEAP)=($opt_S);

use lib ("/home/perl_lib");
use NewSybDBLib;
use Sybase::DBlib;
use IniFileUtil;
use ErrMsgUtil;
use strict;
}

sub main();
main();


print "\nMESSAGE:\n";
$dbh->SetSQLCmd("select * from test ");
@result=$dbh->ExecSQL();
if($dbh->{message_text}) {
print "DB MESSAGE\n";
print $dbh->{message_text} . "\n";
$dbh->{message_text}="";
}
if($dbh->{error_text}) {
$db_error_text=$dbh->{error_text};
$dbh->Delete;
die "ERROR: \n" . $db_error_text . "\n";
}

while (@result = $dbh->fetchrow_array()) {
my $tablename = $result[1];
my $firstrun = $result[2];
my $firstsuccess = $result[3];
print " $tablename $firstrun $firstsuccess \n";
}

The SQL command is getting records from table test .
If i omit my while loop at the end which is using fetchrow_array then script is running perfectly but when i tried to get the records one by one using fetch_row_array() i got the Error :

Can't locate object method "fetchrow_array" via package "NewSybDBLib"

I use the package use Sybase::DBlib but it is not working.

Any idea what might be the solution.

rawat

Last edited by vino; 05-23-2007 at 09:01 AM.. Reason: Disabled smilies
  #2 (permalink)  
Old 06-03-2009
Kuks Kuks is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
Re: Can't locate object method "fetchrow_array" Error

Hey Rawat,

As far as I know, the fetchrow_array is used with the statement handle ($sth) rather than database handle ($dbh). Try to differentiate $dbh and $sth, and put $sth in the appropriate places.

Let me know if that works out!!

Regards,
Kuks
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0