DBI blues
- From: Thomas.Holstein.ctr@xxxxxxxx (Thomas E CTR DISA PAC Holstein)
- Date: Wed, 29 Mar 2006 15:02:01 -1000
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();
.
- Follow-Ups:
- RE: DBI blues
- From: Martin J. Evans
- RE: DBI blues
- Prev by Date: New test for dbd::mysql demonstrating that once an execute fails all other executes on same statement fail
- Next by Date: pod patch for ParamArrays and now optional ArrayTupleStatus
- Previous by thread: New test for dbd::mysql demonstrating that once an execute fails all other executes on same statement fail
- Next by thread: RE: DBI blues
- Index(es):
Relevant Pages
|