in reply to OT: Setting up environment for DB2 on Solaris

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
$ perl use strict; use warnings; use DBI; use DBD::DB2; use Data::Dumper; my $dbh = DBI->connect ('DBI:DB2:sample', 'db2inst1', '.....') or die "connect failed"; my $sth = $dbh->prepare("select * from dept") or die "prepare failed"; my $rv = $sth->execute(); if ($rv) { while(my $hr = $sth->fetchrow_hashref()) { print Dumper($hr); } } $sth->finish() or die "finish failed"; $dbh->disconnect() or die "disconnect failed"; __END__ $VAR1 = { 'LOCATION' => undef, 'DEPTNO' => 'A00', 'MGRNO' => '000010', 'ADMRDEPT' => 'A00', 'DEPTNAME' => 'SPIFFY COMPUTER SERVICE DIV.' };
HTH.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

Replies are listed 'Best First'.
Re^2: OT: Setting up environment for DB2 on Solaris
by talexb (Chancellor) on Nov 04, 2008 at 16:48 UTC

    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]