RE: Connecting to more than one Oracle database



What errors are you getting (ORA- or TNS-)?

Are you defining the other variables necessary - NLS* LD_LIBRARY_PATH,
etc. for your ORACLE_HOME?

Can you tnsping the DBs from your web server? What about connecting via
SQL*Plus?

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Malka Cymbalista [mailto:Malki.Cymbalista@xxxxxxxxxxxxxx]
Sent: Monday, December 11, 2006 7:04 AM
To: modperl@xxxxxxxxxxxxxxx; dbi-users@xxxxxxxx
Subject: Re: Connecting to more than one Oracle database

Hello to all of you, Last week I sent an email asking how to connect to
more than one remote Oracle database. My problem was that in my
startup.pl file, I am setting the following environment variables:
ORACLE_HOME, ORACLE_SID, TWO_TASK and TNS_ADMIN. If I am trying to
connect to 2 different databases, then ORACLE_SID and TWO_TASK are not
the same and I did not know what to do.
SEveral people answered me and said that I should not define
ORACLE_SID and TWO_TASK in startup.pl but that I should define both
databases in tnsnames.ora and simply connect giving the name of the
database.

So now, I am doing the following:
My tnsnames.ora looks like:

asdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = computer1.weizmann.ac.il)(PORT
= 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = asdb.weizmann.ac.il)
)
)

asdb2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = computer2.weizmann.ac.il)(PORT
= 1521))
)
(CONNECT_DATA =
(SID = ORCL92)
)
)
I connect in the following manner:

DBI->connect("DBI:Oracle:asdb","user1","password1");
and
DBI->connect("DBI:Oracle:asdb2","user2","password2");

I have a script that works from the command line but does not work when
I run it from the web. When I run from the web it gives very
inconsistent results. Sometimes it succeeds in connecting to the first
database I specify and sometimes it can't connect to either. I tried
specifying the environment variables ORACLE_SID and TWO_TASK from within
the script but that didn't seem to help consistently. That is,
sometimes it worked and sometimes it didn't and we couldn't figure out
exactly when it would or would not work.
Does anyone know how I can connect via the web to 2 different oracle
databases sitting on 2 different machines from within the same script.

Thanks for any help.



Malka Cymbalista
Webmaster, Weizmann Institute of Science
malki.cymbalista@xxxxxxxxxxxxxx
08-934-3036

This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

.



Relevant Pages

  • Re: Oracle database not starting up after reboot on RedHat ES4 Linux !
    ... I have Oracle database enterprise edition 9.2.0.4 running on RedHat ... I am using dbstart command via a /etc/init.d/oracle file. ... When working with shell scripts that are executed by cron or on system startup, it is often useful to run those scripts in a manner that does not have your environment included in the execution of that script. ...
    (comp.databases.oracle.server)
  • Re: Connect to Access Data from various regional locations
    ... All users will be connecting via broadband. ... When using MSDE ... > Dim rf As DAO.Recordset ... > There is a wizard to split your database into a FE and a BE; ...
    (microsoft.public.access.externaldata)
  • Re: Connect to Access Data from various regional locations
    ... All users will be connecting via broadband. ... When using MSDE ... > Dim rf As DAO.Recordset ... > There is a wizard to split your database into a FE and a BE; ...
    (microsoft.public.access.dataaccess.pages)
  • RE: Problem with connecting to an Oracle database using Perl
    ... Problem with connecting to an Oracle database using Perl ... *IS* described in the DBD::Oracle perldocs - as the perldocs are included ... I do not have a problem connecting to the remote database using the Oracle ...
    (perl.dbi.users)
  • Re: Connecting to more than one oracle database
    ... Connecting to more than one oracle database ... In order to connect to an oracle database on a different machine ... I am currently connecting to an oracle database on a different ...
    (perl.dbi.users)