in reply to Re: Perl $dbh->prepare failed
in thread Perl $dbh->prepare failed


Yes.. I know. there isn't any code information attached to my question. simply because the codes are long and has a lot of sub routines coming from various Modules. :). sorry for that.

Going from one script to another script means this,
User first seeks for employers. That is the task of the first script. And from the result page, users can click on the employer name and go to the employer details page(second script). In the second script, the database handler is newly created if it is not alive.

Replies are listed 'Best First'.
Re^3: Perl $dbh->prepare failed
by blue_cowdawg (Monsignor) on Sep 12, 2006 at 12:47 UTC
        In the second script, the database handler is newly created if it is not alive.

    How are you testing for "alive?" Unless you are using mod_perl or some method of pooling your database handles I'd say you should be opening your handles unconditionally in your second script.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

      actually I thought if the refernce is there(if I can print the reference with some hexadecimal code) the database connection is there.
      I am sort of a beginner and I didn't know that. And there's a high posibility that it is the place where I went wrong.
      Can you please suggest me a way to check whether the database connection is live or not.

      Thanks.
            actually I thought if the refernce is there(if I can print the reference with some hexadecimal code) the database connection is there.

        No... it don't work that way. As soon as your first script exited that handle was destroyed. There's no (easy) way of passing a handle from one process reference to another unless you are using some sort of persistance layer.


        Peter L. Berghold -- Unix Professional
        Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg