DBI blues
am 30.03.2006 03:02:01 von Thomas.Holstein.ctr
Hi, I am trying to install DBI to run a DBtest Script that was written by a
vender. Here is the error I got, the version, and the script I am trying to
run. Unfortunately, I am not very familiar with Perl.
Please let me know if I need to install something else in Perl or make other
changes.
Tom
Install Error
{root@largo}perl Makefile.PL
Can't locate Test/More.pm in @INC (@INC contains: lib
/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1
/usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
/usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at Makefile.PL line
36.
BEGIN failed--compilation aborted at Makefile.PL line 36.
{root@largo}
Perl Version
{root@largo}perl -version
This is perl, v5.6.1 built for sun4-solaris-64int
(with 48 registered patches, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
{root@largo}
perl Script trying to run
#!/usr/bin/perl
#
############################################################ ############
# #
# This listing of source code is proprietary and confidential to #
# Network Equipment Technologies, Inc. It may not be copied or #
# made available in any form (electronic or hard copy) to any #
# person not authorized by Network Equipment Technologies, Inc. #
# Unpublished--Rights reserved under all copyright laws. #
# #
# Copyright (c) 2005, Network Equipment Technologies, Inc. #
# All Rights Reserved. #
# #
############################################################ ############
#
# dbTest.pl - Test script to verify that we can query the netMS
# MySQL or Oracle database. Requires that you have an existing 'ems'
# database created by netMS. The script queries the number of rows in
# the NEEventLog table.
#
# For Oracle you will need to modify the Oracle specific connection
# parameters below. For MySQL provided connection parameters should be
# sufficient.
#
use strict;
use DBI;
print "Utility to test access to netMS Oracle or MySQL database.\n";
if ( $#ARGV != 0 || ( $#ARGV == 0 && $ARGV[0] ne "Oracle" && $ARGV[0] ne
"mysql"))
{
die "Usage: dbTest.pl \n";
}
my $tableName = "NEEVENTLOG";
my $driver = "$ARGV[0]";
# MySQL config
my $server = "localhost";
my $database = "ems";
my $user = "root";
my $password = "";
my $url = "DBI:$driver:$database:$server";
# Oracle config - change this if using Oracle
if ( $ARGV[0] eq "Oracle")
{
$server = ""; # e.g. ""
$database = ""; # e.g. "netms92.net.com"
$user = ""; # e.g. "beat"
$password = ""; # e.g. "beat"
$url = "DBI:$driver:$database";
if ($database eq "")
{
die "Error: you must first set up Oracle parameters in script.\n";
}
}
# Connect to database
my $dbh = DBI->connect( $url, $user, $password ) or die "Cannot connect!\n";
my $drh = DBI->install_driver("mysql");
my @databases = DBI->data_sources("mysql");
print "Testing connection to netMS MySQL database ...\n";
print "Connected to '$driver:$database:$server' as user '$user'\n\n";
# Get all rows for table
my $sth = $dbh->prepare("SELECT * FROM $tableName");
$sth->execute;
my $numRows = 0;
my $numFields = 0;
$numRows = $sth->rows;
$numFields = $sth->{'NUM_OF_FIELDS'};
# Print summary
print "$tableName\n\tnumber of rows: $numRows\n\tnumber of fields:
$numFields\n\n";
# Print rows
if ($numRows > 0)
{
my $count = 1;
while (my $ref = $sth->fetchrow_hashref())
{
print "Row[$count]: \ttype = $ref->{'type'} subtype =
$ref->{'subType'} evName = $ref->{'eventName'} \n";
$count += 1;
}
}
else
{
print "No rows in log.\n";
}
$sth->finish;
# Disconnect from database
$dbh->disconnect();
RE: DBI blues
am 30.03.2006 12:12:41 von Martin.Evans
On 30-Mar-2006 Holstein, Thomas E CTR DISA PAC wrote:
> Hi, I am trying to install DBI to run a DBtest Script that was written by a
> vender. Here is the error I got, the version, and the script I am trying to
> run. Unfortunately, I am not very familiar with Perl.
>
> Please let me know if I need to install something else in Perl or make other
> changes.
You need Test::More ->
http://search.cpan.org/~mschwern/Test-Simple-0.62/lib/Test/M ore.pm
and by the looks of the script, you will later need the oracle and mysql dbds
which you'll also find on cpan.
Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com
> Tom
>
> Install Error
>
> {root@largo}perl Makefile.PL
> Can't locate Test/More.pm in @INC (@INC contains: lib
> /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
> /usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1
> /usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
> /usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at Makefile.PL line
> 36.
> BEGIN failed--compilation aborted at Makefile.PL line 36.
> {root@largo}
>
> Perl Version
>
> {root@largo}perl -version
>
> This is perl, v5.6.1 built for sun4-solaris-64int
> (with 48 registered patches, see perl -V for more detail)
>
> Copyright 1987-2001, Larry Wall
>
> Perl may be copied only under the terms of either the Artistic License or
> the
> GNU General Public License, which may be found in the Perl 5 source kit.
>
> Complete documentation for Perl, including FAQ lists, should be found on
> this system using `man perl' or `perldoc perl'. If you have access to the
> Internet, point your browser at http://www.perl.com/, the Perl Home Page.
>
> {root@largo}
>
> perl Script trying to run
>
>#!/usr/bin/perl
>#
>########################################################### #############
># #
># This listing of source code is proprietary and confidential to #
># Network Equipment Technologies, Inc. It may not be copied or #
># made available in any form (electronic or hard copy) to any #
># person not authorized by Network Equipment Technologies, Inc. #
># Unpublished--Rights reserved under all copyright laws. #
># #
># Copyright (c) 2005, Network Equipment Technologies, Inc. #
># All Rights Reserved. #
># #
>########################################################### #############
>#
># dbTest.pl - Test script to verify that we can query the netMS
># MySQL or Oracle database. Requires that you have an existing 'ems'
># database created by netMS. The script queries the number of rows in
># the NEEventLog table.
>#
># For Oracle you will need to modify the Oracle specific connection
># parameters below. For MySQL provided connection parameters should be
># sufficient.
>#
> use strict;
> use DBI;
>
> print "Utility to test access to netMS Oracle or MySQL database.\n";
>
> if ( $#ARGV != 0 || ( $#ARGV == 0 && $ARGV[0] ne "Oracle" && $ARGV[0] ne
> "mysql"))
> {
> die "Usage: dbTest.pl \n";
> }
>
> my $tableName = "NEEVENTLOG";
> my $driver = "$ARGV[0]";
>
># MySQL config
> my $server = "localhost";
> my $database = "ems";
> my $user = "root";
> my $password = "";
> my $url = "DBI:$driver:$database:$server";
>
># Oracle config - change this if using Oracle
> if ( $ARGV[0] eq "Oracle")
> {
> $server = ""; # e.g. ""
> $database = ""; # e.g. "netms92.net.com"
> $user = ""; # e.g. "beat"
> $password = ""; # e.g. "beat"
> $url = "DBI:$driver:$database";
>
> if ($database eq "")
> {
> die "Error: you must first set up Oracle parameters in script.\n";
> }
> }
>
># Connect to database
> my $dbh = DBI->connect( $url, $user, $password ) or die "Cannot connect!\n";
> my $drh = DBI->install_driver("mysql");
> my @databases = DBI->data_sources("mysql");
>
> print "Testing connection to netMS MySQL database ...\n";
> print "Connected to '$driver:$database:$server' as user '$user'\n\n";
>
># Get all rows for table
> my $sth = $dbh->prepare("SELECT * FROM $tableName");
> $sth->execute;
>
> my $numRows = 0;
> my $numFields = 0;
> $numRows = $sth->rows;
> $numFields = $sth->{'NUM_OF_FIELDS'};
>
>
># Print summary
> print "$tableName\n\tnumber of rows: $numRows\n\tnumber of fields:
> $numFields\n\n";
>
># Print rows
> if ($numRows > 0)
> {
> my $count = 1;
> while (my $ref = $sth->fetchrow_hashref())
> {
> print "Row[$count]: \ttype = $ref->{'type'} subtype =
> $ref->{'subType'} evName = $ref->{'eventName'} \n";
> $count += 1;
> }
> }
> else
> {
> print "No rows in log.\n";
> }
>
> $sth->finish;
>
># Disconnect from database
> $dbh->disconnect();
RE: DBI blues
am 30.03.2006 17:40:12 von Ron.Reidy
Install Test::More
sudo perl -MCPAN -e 'install Test::More'
-----Original Message-----
From: Holstein, Thomas E CTR DISA PAC
[mailto:Thomas.Holstein.ctr@disa.mil]=20
Sent: Wednesday, March 29, 2006 6:02 PM
To: 'dbi-users@perl.org'
Subject: DBI blues
Hi, I am trying to install DBI to run a DBtest Script that was written
by a vender. Here is the error I got, the version, and the script I am
trying to run. Unfortunately, I am not very familiar with Perl.
Please let me know if I need to install something else in Perl or make
other changes.
Tom
Install Error
{root@largo}perl Makefile.PL
Can't locate Test/More.pm in @INC (@INC contains: lib
/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1
/usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
/usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at Makefile.PL
line 36. BEGIN failed--compilation aborted at Makefile.PL line 36.
{root@largo}
Perl Version
{root@largo}perl -version
=20
This is perl, v5.6.1 built for sun4-solaris-64int
(with 48 registered patches, see perl -V for more detail)
=20
Copyright 1987-2001, Larry Wall
=20
Perl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the Perl 5
source kit.
=20
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to
the Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
=20
{root@largo}
=20
perl Script trying to run
=20
#!/usr/bin/perl
#
############################################################ ############
# #
# This listing of source code is proprietary and confidential to #
# Network Equipment Technologies, Inc. It may not be copied or #
# made available in any form (electronic or hard copy) to any #
# person not authorized by Network Equipment Technologies, Inc. #
# Unpublished--Rights reserved under all copyright laws. #
# #
# Copyright (c) 2005, Network Equipment Technologies, Inc. #
# All Rights Reserved. #
# #
############################################################ ############
#
# dbTest.pl - Test script to verify that we can query the netMS # MySQL
or Oracle database. Requires that you have an existing 'ems'=20
# database created by netMS. The script queries the number of rows in=20
# the NEEventLog table.
#
# For Oracle you will need to modify the Oracle specific connection #
parameters below. For MySQL provided connection parameters should be #
sufficient.=20
#
use strict;
use DBI;
=20
print "Utility to test access to netMS Oracle or MySQL database.\n";
=20
if ( $#ARGV !=3D 0 || ( $#ARGV == 0 && $ARGV[0] ne "Oracle" && =
$ARGV[0]
ne
"mysql"))=20
{
die "Usage: dbTest.pl \n";
}
=20
my $tableName =3D "NEEVENTLOG";
my $driver =3D "$ARGV[0]";
=20
# MySQL config
my $server =3D "localhost";
my $database =3D "ems";
my $user =3D "root";
my $password =3D "";
my $url =3D "DBI:$driver:$database:$server";
=20
# Oracle config - change this if using Oracle
if ( $ARGV[0] eq "Oracle")
{
$server =3D ""; # e.g. ""
$database =3D ""; # e.g. "netms92.net.com"=20
$user =3D ""; # e.g. "beat"
$password =3D ""; # e.g. "beat"
$url =3D "DBI:$driver:$database";
=20
if ($database eq "")
{
die "Error: you must first set up Oracle parameters in
script.\n";
}
}
=20
# Connect to database
my $dbh =3D DBI->connect( $url, $user, $password ) or die "Cannot
connect!\n"; my $drh =3D DBI->install_driver("mysql"); my @databases =3D
DBI->data_sources("mysql");
=20
print "Testing connection to netMS MySQL database ...\n";
print "Connected to '$driver:$database:$server' as user '$user'\n\n";
=20
# Get all rows for table
my $sth =3D $dbh->prepare("SELECT * FROM $tableName"); $sth->execute;
=20
my $numRows =3D 0;
my $numFields =3D 0;
$numRows =3D $sth->rows;
$numFields =3D $sth->{'NUM_OF_FIELDS'};
=20
=20
# Print summary
print "$tableName\n\tnumber of rows: $numRows\n\tnumber of fields:
$numFields\n\n";
=20
# Print rows
if ($numRows > 0)
{
my $count =3D 1;
while (my $ref =3D $sth->fetchrow_hashref())=20
{
print "Row[$count]: \ttype =3D $ref->{'type'} subtype =3D
$ref->{'subType'} evName =3D $ref->{'eventName'} \n";
$count +=3D 1;
}
}
else
{
print "No rows in log.\n";
}
=20
$sth->finish;
=20
# Disconnect from database
$dbh->disconnect();
This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.