Oracle FAQ Your Portal to the Oracle Knowledge Grid

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

Re: PERL DBI connection to Remote Oracle Database

From: Sanjay Mishra <>
Date: Tue, 28 Aug 2007 12:57:00 -0700 (PDT)
Message-ID: <>


  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.    


Stefan Knecht <> 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.


  On 8/28/07, Sanjay Mishra <> 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" <> 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: [] On Behalf Of Sanjay Mishra Sent: Tuesday, August 28, 2007 8:42 AM
Subject: PERL DBI connection to Remote Oracle Database   


  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(";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.    


  Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. 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.      

  Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.


Stefan P Knecht
Infrastructure Managed Services

Trivadis AG
Europa-Strasse 5
CH-8152 Glattbrugg

Phone +41-44-808 70 20
Fax +41-808 70 12
Mobile +41-79-571 36 27


Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
-- Received on Tue Aug 28 2007 - 14:57:00 CDT

Original text of this message