- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- perl scripts error!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 02:15 PM
тАО03-30-2004 02:15 PM
perl scripts error!
F0llowing is my per1 scripts,it has some error...
What I going to do it ? Thanks!
#! /opt/perl64/bin/perl5.8.3
use DBI;
use DBD::Informix;
my $data_source = "DBI:Informix:pdview";
my $server = "aaatcp";
my $database = "pdaaa";
my $username = "pdbbb";
my $password = "pdbbb";
my $dbh = DBI->connect($data_source, $username, $password) or die "Error! $DBI::errstr";
print "Connetc informix server ok......\n";
$sql = "SELECT * FROM cam2asics";
$sth = $dbh->prepare($sql);
$sth -> execute() or die ("error!");
print "$database include......:\n";
while(@rows = $sth->fetchrow_array)
{
foreach(@rows)
{
print "$_\t";
}
print "\n";
}
$sth->finish;
$dbh -> disconnect();
exit 0;
result message:
Connetc informix server ok......
Can't call method "execute" on an undefined value at connect2 line 13.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 02:35 PM
тАО03-30-2004 02:35 PM
Re: perl scripts error!
When I used perl to handle sqlplus I had to worry about special characters like @ that trip up the interpreter. You have to put a special character in froont of special characters to have them not break up the string and blow up the script.
@ has to be \@
" needs to be \"
I don't know the full list of special characters, but this is a likely problem with your script.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 04:51 PM
тАО03-30-2004 04:51 PM
Re: perl scripts error!
Hmmm, should line 13 read:
$result = $sth -> execute() or die ("error!");
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 05:06 PM
тАО03-30-2004 05:06 PM
Re: perl scripts error!
$quoted_string = $dbh->quote ($string);
Hein: no, the error is earlier. The error complains about the statement handle being undefined, and thus cannot execute the 'execute' method at all.
It is the prepare that fails
print "Connect informix server ok......\n";
$sql = "SELECT * FROM cam2asics";
$dbh->trace (9);
$sth = $dbh->prepare ($sql);
# At this point, the $sth is probably undefined
$dbh->trace (0);
print STDERR $dbh->errstr;
Could probably give you the information you need to resolv the issue
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 05:52 PM
тАО03-30-2004 05:52 PM
Re: perl scripts error!
I use this scripts runing with the windows 2000 environment is ok!
But use it with HPUX still error....
Please give me help,thanks sir!
=========================================
use DBI;
use DBD::Informix;
my $data_source = "DBI:Informix:pdview";
my $username = "pduser";
my $password = "pduser";
my $dbh = DBI->connect($data_source, $username, $password) or die "Error! $DBI::errstr";
print "Connetc informix server ok......\n";
$sql = "SELECT * FROM cam2asics";
$dbh->trace(9);
$sth = $dbh->prepare($sql);
$dbh->trace(0);
print STDERR $dbh->errstr;
$sth -> execute() or die "error! can't prepare SQL", $dbh->errstr(), "\n";
print "$rrr\n";
print "$database include......:\n";
while(@rows = $sth->fetchrow_array)
{
foreach(@rows)
{
print "$_\t";
}
print "\n";
}
$sth->finish;
$dbh -> disconnect();
exit 0;
=============================================
#result message
Connetc informix server ok......
DBI::db=HASH(0x800000000025bb00) trace level set to 9 in DBI 1.40-nothread (pid 7614)
Note: perl is running without the recommended perl -w option
-> prepare for DBD::Informix::db (DBI::db=HASH(0x8000000000046758)~0x800000000025bb00 'SELECT * FROM cam2asics')
dbih_setup_handle(DBI::st=HASH(0x800000000025bc68)=>DBI::st=HASH(0x800000000025bd08), DBD::Informix::st, 800000000025bc78, Null!)
dbih_make_com(DBI::db=HASH(0x800000000025bb00), 8000000000152940, DBD::Informix::st, 360, 0) thr#0
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), Err, DBI::db=HASH(0x800000000025bb00)) SCALAR(0x800000000014e1e8) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), State, DBI::db=HASH(0x800000000025bb00)) SCALAR(0x800000000014e188) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), Errstr, DBI::db=HASH(0x800000000025bb00)) SCALAR(0x800000000014e1b8) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), TraceLevel, DBI::db=HASH(0x800000000025bb00)) 9 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), FetchHashKeyName, DBI::db=HASH(0x800000000025bb00)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x800000000025bd08), HandleError, DBI::db=HASH(0x800000000025bb00)) undef (not defined)
-->> DBD::Informix::dbd_ix_st_prepare()
<<-- DBD::Informix::dbd_ix_st_prepare()
>> DESTROY DISPATCH (DBI::st=HASH(0x800000000025bc68) rc1/1 @1 g0 ima4 pid#7614) at connect2 line 10
<> DESTROY ignored for outer handle DBI::st=HASH(0x800000000025bc68) (inner DBI::st=HASH(0x800000000025bd08))
>> DESTROY DISPATCH (DBI::st=HASH(0x800000000025bd08) rc1/1 @1 g0 ima4 pid#7614) at connect2 line 10
-> DESTROY for DBD::Informix::st (DBI::st=HASH(0x800000000025bd08)~INNER)
Statement handle DBI::st=HASH(0x800000000025bd08) DESTROY ignored - never set up
<- DESTROY= undef at connect2 line 10
DESTROY (dbih_clearcom) (sth 0x800000000025bc68 0x0, com 0x8000000000283b88, imp DBD::Informix::st):
FLAGS 0x111: COMSET Warn PrintError
PARENT DBI::db=HASH(0x800000000025bb00)
KIDS 0 (0 Active)
IMP_DATA undef
NUM_OF_FIELDS 0
NUM_OF_PARAMS 0
dbih_clearcom 0x800000000025bc68 (com 0x8000000000283b88, type 3) done.
<- prepare= undef at connect2 line 10
-> trace for DBD::Informix::db (DBI::db=HASH(0x8000000000046758)~0x800000000025bb00 0)
<- trace= 9 at connect2 line 11
Can't call method "execute" on an undefined value at connect2 line 13.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 06:41 PM
тАО03-30-2004 06:41 PM
Re: perl scripts error!
I also do not see the error message.
Could you show:
my $dbh = DBI->connect ($data_source, $username, $password) or die "Error! $DBI::errstr";
print "Connect informix server ok......\n";
$dbh->{PrintError} = 1;
$dbh->{RaiseError} = 1;
$sql = "SELECT * FROM cam2asics";
$sth = $dbh->prepare ($sql);
And also, given that "name" is a valid field in table cam2asics, what does
my $dbh = DBI->connect ($data_source, $username, $password) or die "Error! $DBI::errstr";
print "Connect informix server ok......\n";
$dbh->{PrintError} = 1;
$dbh->{RaiseError} = 1;
$sth = $dbh->prepare ("select name from cam2asics");
Also consider taking this to dbi-users mailing list, where Informix expertise is more likely to be present
Enjoy, Have FUN! H.Merijn