If you have a "normal" installation...in particular, your tnsnames.ora
and any whatever other .ora files reside in
$ORACLE_HOME/network/admin/. Then only $ORACLE_HOME need be supplied,
then you can create a connection for every database in your
tnsnames.ora file if you like.  If tnsnames.ora resides somewhere
else, then $TNS_ADMIN needs to point to the directory containing that
file.  I suggest that if tnsnames.ora doesn't contain aliases for all
of the databases you need to connect to, then add them to it.  If you
can't and your DBA won't, then make a copy that you own and point
TNS_ADMIN to its location. (The pitfall here is that if the DBA adds
or changes anything in the master copy, you won't get the
change...much better to have the DBA add them.)

my $this_dbh = DBI->connect('dbi:Oracle:this_sid',$this_user,$this_password);
my $that_dbh = DBI->connect('dbi:Oracle:that_sid',$that_user,$that_password);

On 11/29/06, Barksdale, Ray <[EMAIL PROTECTED]> wrote:
You could try specifying the host and sid in the connect string.
That way you only need ORACLE_HOME defined, nothing else.
Something like this:

my $dsn = 'dbi:Oracle:host=grill-name;sid=pork-roast;port=1525';



________________________________

        From: Malka Cymbalista [mailto:[EMAIL PROTECTED]
        Sent: Wednesday, November 29, 2006 2:28 AM
        To: modperl@perl.apache.org; dbi-users@perl.org
        Subject: Connecting to more than one oracle database


        I am running Apache 2.0.55 with mod_perl 2.0.1 and Perl 5.8.1 on
a Sun Solaris machine. I am using DBI/DBD to connect to an Oracle
database.  I am running DBI 1.39 and DBD-Oracle 1.16.

        In order to connect to an oracle database on a different machine
I have a tnsnames.ora file with the appropriate definition. I also have
a file startup.pl with the following information:
        $ENV{ORACLE_HOME} = '/usr/local/ora9i/9.2.0';
        $ENV{ORACLE_SID} = 'asdb';
        $ENV{TWO_TASK} = 'asdb';
        $ENV{TNS_ADMIN} =
'/usr/local/ora9i/9.2.0/network/admin/DEV_wiccdb';
        In httpd.conf I have the line
        PerlRequire "/www/httpd/conf/startup.pl"

        I am currently connecting to an oracle database on a different
machine and everything is working fine.  I would now like to connect to
another oracle database on another machine.  My problem is how to define
my environment variables.  ORACLE_HOME and TNS_ADMIN do not seem to be a
problem since I assume they can be the same.  However, how do I define
ORACLE_SID and TWO_TASK so that they allow connecting to 2 different
databases on 2 different machines?

        Thanks for any help.


        Malka Cymbalista
        Webmaster, Weizmann Institute of Science
        [EMAIL PROTECTED]
        08-934-3036

CONFIDENTIALITY NOTICE    This e-mail and any files or attachments may contain 
confidential and privileged information.
If you have received this message in error, please notify the sender at the 
above e-mail address and delete it and
all copies from your system.





--
--------------------------------------------------------------------------------------------------------------
The darkest places in hell are reserved for those who maintain their
neutrality in times of moral crisis.
   Dante Alighieri (1265 - 1321)

They who would give up an essential liberty for temporary security,
deserve neither liberty or security.
Benjamin Franklin

Our lives begin to end the day we become silent about things that matter.
Martin Luther King

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no warrants shall issue, but upon probable cause,
supported by oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.

Amendment IV to the Constitution of the United States
--------------------------------------------------------------------------------------------------------------

Reply via email to