Thanks for the links. You knew what to search for. I search for the "i can't work out... and did not find what you found.

Sounds just like my problem.

I inserted code before each of the two ExecuteQuery calls:

warn("1st call Connection-database handle: '$dbh' dsn: '$dsn'");

and

warn("2nd call Connection-database handle: '$dbh' dsn: '$dsn'");

And got the following in the error log:

Fri Sep 29 17:28:23 2017 manage_users.cgi: 1st call Connection-database handle: 'DBI::db=HASH(0x2928270)' dsn: 'dbi:mysql:database=jalamior_assoc_mgr;host=localhost' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 625.

Fri Sep 29 17:28:23 2017 manage_users.cgi: 2nd call connection-database handle: 'DBI::db=HASH(0x2928270)' dsn: 'dbi:mysql:database=jalamior_assoc_mgr;host=localhost' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 666.

(in cleanup) Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26

I don't see where "it can't see the driver information.." So this must mean that something happens downstream in the call to executequery. Now back to square one as best I can see. I added $session->flush() with no effect.

sub ExecuteQuery { my ($SQL) = @_; my $sth = $dbh->prepare($SQL) or die $dbh->errstr; $sth->execute() or die $dbh->errstr; # $dbh->commit or die $dbh->errstr; # my $sth = $dbh->prepare($SQL) || ErrorMessage($SQL); # $sth->execute() || ErrorMessage($SQL); return $sth; $session->flush(); }

Session opened for all routines in this .pm

sub OpenSession{ my ($dbh, $sid)= @_; $session = new CGI::Session("driver:MySQL", $sid, {Handle=>$dbh, Lo +ckHandle=>$dbh}); return $session; }

Can you see a problem with these?


In reply to Re^2: DBI Problem by Anonymous Monk
in thread DBI Problem by tultalk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.