RE: DBI blues



Install Test::More

sudo perl -MCPAN -e 'install Test::More'

-----Original Message-----
From: Holstein, Thomas E CTR DISA PAC
[mailto:Thomas.Holstein.ctr@xxxxxxxx]
Sent: Wednesday, March 29, 2006 6:02 PM
To: 'dbi-users@xxxxxxxx'
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

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 <Oracle | mysql>\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();

This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
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.

.



Relevant Pages

  • Re: Need help installing WWW-Search-Ebay-2.193 Module...
    ... One of the O'Reilly Books has a script that calls this ... perl Makefile.PL ... you may need to find and install command-line versions of tar and gzip ... > ActivePerl for Linux under Cygwin ...
    (comp.lang.perl.misc)
  • Re: DBD::Oracle Install Mystery
    ... getting trying to install DBD::Oracle: ... Looking at your compile line above I'm guessing you are using Oracle 8.1.6 and that OCI_FETCH_CURRENT was not available in 8.1.6)or at least not defined). ... get a recent instant client and instant client sdk and compile DBD::Oracle against that. ... Perl 5.10 recently installed with gcc, ...
    (perl.dbi.users)
  • Re: Apache, Oracle, Perl DBI Problems
    ... I believe at the start of every perl cgi script interfacing ... 'perl dbi oracle'. ...
    (perl.dbi.users)
  • Re: install_driver(Oracle) failed: wrong ELF class: DynaLoader.pm
    ... I'm not the Oracle expert - treat what I say with a pinch of salt. ... So, if your Perl script sets LD_LIBRARY_PATH, ... Try modifying your cron job so that it runs a shell script which sets at ...
    (perl.dbi.users)
  • Re: Question on input password on ssh prompt
    ... I am writing a perl script running on the XP, ... However right after I made the system call for ssh, ... Is that a way I can feed it the password without install any ...
    (comp.lang.perl.misc)