RE: DBI blues




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/More.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 <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();
.



Relevant Pages

  • IBM Informix Web DataBlade: Local root by design
    ... IBM Informix Web DataBlade: Local root by design ... Impact: Any user who can: 1) Save a Perl script anywhere on the server's ... admin right on any database can do it by loading the WDB module into ...
    (Bugtraq)
  • RE: Memory fault(coredump) with two DBD type connections
    ... I get a core dump ... all the libraries are the same threaded model(single threaded perl uses ... I am running Perl 5.8.8 with DBD-Oracle 1.19 compiled against Oracle ... when I try to connect to the same Oracle database AND same DB2 database ...
    (perl.dbi.users)
  • Re: free unreferenced scalar error
    ... >> The test script is as trim as it gets. ... If the database is other than SQL Server the ... This is perl, v5.8.4 built for MSWin32-x86-multi-thread ... Step 2: Copy script file ...
    (perl.dbi.users)
  • Re: RMAN backup strategy on 10g r2 on linux
    ... running (e.g. if your database was created after Oracle installation ... database, which of course is the proverbial chocolate fireguard. ... how to efficiently backup and restore our instance of the db. ... I wrote a shell script that is called by cron every night. ...
    (comp.databases.oracle.server)
  • DBI blues
    ... Here is the error I got, the version, and the script I am trying to ... I am not very familiar with Perl. ... # MySQL or Oracle database. ... # database created by netMS. ...
    (perl.dbi.users)