Fwd: Need support for Perl::DBD::mysql

Donna Cote <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CALO6=VwV5z0qLoc1g81_TpgGy0QM+B7z_15RJj9cqMq4LzFkgQ@mail.gmail.com>
PROBLEM:
I have perl-DBD-MySQL-4.013-release-3.el6 and Perl 5.10.1 and while I have
a user account which can connect to the database at the command prompt, I
cannot get the same user (or any user) to connect from within my Perl
script. Actually, I succeeded with one connection one time (from within
Perl script) on 20-Dec-2015 (Sun Dec 20 22:35:53 CST 2015).

Regards, Donna [email protected]


​INFO:​
Name        : perl-DBD-MySQL
Arch        : x86_64
Version     : 4.013
Release     : 3.el6
Size        : 338 k
Repo        : installed
From repo   : centos-base

[d-cote@earthdata Perl]$ perl -V
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

  Platform:
    osname=linux, osvers=2.6.32-220.el6.x86_64,
archname=x86_64-linux-thread-multi
    uname='linux c6b8.bsys.dev.centos.org 2.6.32-220.el6.x86_64 #1 smp tue
dec 6 19:48:22 gmt 2011 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic -DDEBUGGING=-g -Dversion=5.10.1 -Dmyhostname=localhost
-Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr
-Dvendorprefix=/usr -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5
-Dprivlib=/usr/share/perl5 -Darchlib=/usr/lib64/perl5
-Dvendorlib=/usr/share/perl5/vendor_perl
-Dvendorarch=/usr/lib64/perl5/vendor_perl -Dinc_version_list=5.10.0
-Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64
/usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles
-Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog
-Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005
-Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto
-Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto
-Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto
-Dscriptdir=/usr/bin -Dusesitecustomize'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-4)',
gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector'
    libpth=/usr/local/lib64 /lib64 /usr/lib64
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.12'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib64/perl5/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE
  Built under linux
  Compiled at Nov 22 2013 18:29:21
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5

SCRIPT    .
[d-cote@earthdata Perl]$ cat gather-details-n-do-db-inserts.pl
#!/usr/bin/perl -w
# ~d-cote/Perl/gather-details-n-do-db-inserts.pl
#
# ./gather-details-n-do-db-inserts.pl ldm1-log-sample.log 2>
/tmp/test-pl-errors.log
#
#  will want to read text file without any order, then
#   build an SQL insert statement for each input line
#
use DBI;
use strict;
use warnings;
use Time::Local;
use DateTime::Format::Strptime;
            <snip>
    my $configinfofn = "/opt/ldmsurvey/scripts/.config";
    open($setupfh, "< $encoding", $configinfofn) || die("can't open
datafile (named $configinfofn): $!");
    my $myline = readline($setupfh);            ### reading one line from
config file
    ($database, $userid, $password) = split(',',$myline,3);
    close($setupfh);
#$ cat /opt/ldmsurvey/scripts/.config
print "  debug 58: post gather-db-config-routine, database=$database,
userid=$userid \n";

my $driver = "mysql";
my $dsn = "dbi:$driver:$database";

my $dbh;
print " debug 65 pre attempt db connection with $dsn  $userid  $password
\n";
$dbh = DBI->connect($dsn, $userid, $password) or die $DBI::errstr;
my $sth = $dbh->prepare("select id, hostname, ipaddr from hosts ");
$sth->execute() or die $DBI::errstr;
print "Number of rows found :" . $sth->rows . "\n";
#my @datarows = $sth->fetchrow_array();
while (my @row = $sth->fetchrow_array()) {
   my ($hostid, $hostname, $hostip ) = @row;
   print "host id = $hostid, host name = $hostname, host ip = $hostip \n";
}
$sth->finish();
print "  debug 76: post attempt at dbconnection, database=$database,
userid=$userid \n";
            <snip>
my $rc = DBI->disconnect or warn $dbh->errstr;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.