Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: PERL DBI connection to Remote Oracle Database

RE: PERL DBI connection to Remote Oracle Database

From: Lawie, Duncan <duncan.lawie_at_credit-suisse.com>
Date: Wed, 29 Aug 2007 11:19:27 +0100
Message-ID: <CBBD2FE7939E3F4C983D8D93461CB7642F6364@ELON17P32001A.csfb.cs-group.com>


Sanjay,  

if you wish to connect to the listener on port 1523, put that in the connect string  

$dbh = DBI->connect("dbi:Oracle:host=myhost.com;sid=ORCL;port=1523",
$user, $passwd);
 

HTH,
Duncan.


From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sanjay Mishra Sent: 28 August 2007 20:57
To: Stefan Knecht
Cc: oracle-l
Subject: Re: PERL DBI connection to Remote Oracle Database

Stefan  

Yes you are right that there are two listener Running. Listener 1521 show both db1 and DB2 even I am running different listener for DB2 with Port 1523.  

So this might be the reason that perl script is working fine. If you see the document from Perl, it shows that it will also check for 1526. Is 1521 and 1526 are kind of default port if they are not specified.  

TIA
Sanjay

Stefan Knecht <knecht.stefan_at_gmail.com> wrote:

        You have 2 listeners ? One of them happen to listen on port 1521 ? Does the database in question show up if you query the services of that listener (lsnrctl serv <listener_name_on_port_1521>) -- perhaps the database registered itself on that listener without you knowing.         

        Stefan                  

        On 8/28/07, Sanjay Mishra <smishra_97_at_yahoo.com> wrote:

                Ron                  

                It is working and I am trying to understand as how it is making connection even the Port is not defined. On Remote DB server, I am running two listener. How this program use SID defined in Perl to connect to correct instance.                                   

                "Reidy, Ron" < Ron.Reidy_at_arraybiopharma.com <mailto:Ron.Reidy_at_arraybiopharma.com> > wrote:

                        My guess is it won't make a connection except for the default ports. What happens if you try it yourself with a small program?                          

			Ron Reidy 
			Lead DBA
			 

________________________________

			From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sanjay Mishra 
			Sent: Tuesday, August 28, 2007 8:42 AM
			To: oracle-l_at_freelists.org
			Subject: PERL DBI connection to Remote Oracle
Database                                                  

                        Hi                          

                        I am working on exsiting Perl program and found that it is usinf DBI to connect to Remote Database . The string used to connect the Remote database doesn't have PORT. Connection is going fine. Remote database is listening on PORT 1523 and not the Default 1521.                          

                        I checked the Manual and it says the following but still not clear as if it only check on 1521 and 1526 or others. Any ideas as how it will work if Port is not specified like even shown below in the Doc statement

                        Connecting without environment variables or tnsname.ora file

                        If you use the host=$host;sid=$sid style syntax, for example:

                          $dbh =
DBI->connect("dbi:Oracle:host=myhost.com <http://myhost.com/> ;sid=ORCL", $user, $passwd);

                        then DBD::Oracle will construct a full connection descriptor string for you and Oracle will not need to consult the tnsname.ora file.

                        If a port number is not specified then the descriptor will try both 1526 and 1521 in that order ( e.g., new then old). You can check which port(s) are in use by typing "$ORACLE_HOME/bin/lsnrctl stat" on the server.                          

                        Sanjay



Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html


--
http://www.freelists.org/webpage/oracle-l
Received on Wed Aug 29 2007 - 05:19:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US