in reply to DBI connection through CGI

Whenever something works at the command line, but doesn't through CGI, that almost always means that you have a permissions/access problem due to the fact that your webserver runs as a different userid than the one you are logged in as. Find out what userid your webserver runs as, and grant that userid privileges on your database.

Replies are listed 'Best First'.
Re: Re: DBI connection through CGI
by Phemur (Beadle) on May 20, 2002 at 22:26 UTC
    Thanks Sue,

    I'm still going through all of the access permissions, but at this point, my guess is that the problem lies with MySQL. I changed the permissions to root for testing, and it worked. I then tried logging into MySQL with the previous username/password, and that failed, even though that signon was part of the user table.

    To get back to Perl, does anyone know why DBI::errmsg would not be set if connect failed?

    Thanks again,

    Nat

      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);

        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