in reply to Re: Re: DBI connection through CGI
in thread DBI connection through CGI

does anyone know why DBI::errmsg would not be set...

Perhaps you might find $DBI::errstr a little more useful :)

cLive ;-)

--
seek(JOB,$$LA,0);

Replies are listed 'Best First'.
Re: Re: Re: Re: DBI connection through CGI
by Phemur (Beadle) on May 21, 2002 at 12:16 UTC
    Hi cLive,

    I tried $DBI::errstr last night, and I got a bunch of Win32 errors (couldn't find cmd.exe, etc), which is normal, since I'm running under Linux. I'm still trying to figure this one out.

    I did a bit more digging in my Perl books (Perl in a Nutshell, O'Reilly, section 12.3), and it seems that errstr should be used in the following manner:

    $dbHandle->errstr
    as opposed to
    $DBI::errstr
    I'm not familliar enough with Perl to say if these two statements are equivalent, but I'll look into it tonight as well.

    Finally, the reason I've been referring to $DBI::errmsg is because it's what's written in O'Reilly's MySQL & mSQL book. I don't have the book handy right now, but I'll double check to make sure I'm not making a fool out of myself during my first impression. I'm sure there will be ample opportunity for that later. :-)

    Nat

      $dbHandle->errstr is object-oriented syntax, $DBI::errstr is procedural syntax. In theory, calling errstr using a dbHandle should return the last error on that handle and calling it through the DBI module should return the last error seen anywhere in the database. But, given that
      1. Many programs only use a single database connection
      2. Many database engines only preserve a single error message per client
      3. You should check your error messages immediately, before going on to another database operation
      they end up being interchangable in practice.