talexb has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to find out which environment variables are required for a DB2 connection through DBI. The only one I'm using now is DB2INSTANCE.

I was setting INSTHOME (incorrectly, as it turned out) and DB2_HOME, but I commented those out and things still worked properly. I don't have DB2_PATH or SQLLIB set either, as per this node, and I'm not getting the scary sounding Total Environment Failure that I was getting earlier (sounds like an emergency on the International Space Station).

I have searched and searched through the IBM DB2 site without much success. Thanks!

Update: Earlier this afternoon I got verification from waveform on #db2 that DB2INSTANCE is all that's required for PHP, so if the drivers are at all similar, it makes sense that only DB2INSTANCE is required for Perl as well.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

  • Comment on OT: Setting up environment for DB2 on Solaris

Replies are listed 'Best First'.
Re: OT: Setting up environment for DB2 on Solaris
by dHarry (Abbot) on Nov 04, 2008 at 09:43 UTC

      This is a useful link, but in my case it is inaccurate, or rather, incomplete.

      In my particular environment, I also need to set the DB2INSTANCE environment variable to the name of the DB2 instance that I'm currently using. Failing to do that provokes the following error:

      ERROR=Total Environment allocation failure! \ Did you set up your DB2 client environment?
      Apparently this is a known feature of using DB2 from Perl, and I've been told that the same things happens using Oracle.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: OT: Setting up environment for DB2 on Solaris
by andreas1234567 (Vicar) on Nov 04, 2008 at 09:59 UTC
    I don't know about Solaris, but for DB2 on Linux I have the following environment variables set (I'm using bash):
    DB2DIR=/opt/ibm/db2/V9.1 DB2INSTANCE=db2inst1 INSTHOME=/home/db2inst1
    HTH.
    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

      Thanks, but that doesn't answer my question.

      Do you really need the DB2DIR and INSTHOME environment variables? I don't, and I'm trying to find out what minimum is required to run Perl code to access DB2. I don't want to have to rely blindly on the db2profile script.

      I'd be very interested to find out what happens for you if you delete everything except DB2INSTANCE from your environment, and run your script again.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        I get the same results when I keep DB2INSTANCE only:
        $ unset DB2DIR $ unset INSTHOME
        --
        No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]