FAQ
To those who could help me with a problem connecting to an Oracle database on HP-UX from within a perl script that uses DBI

I have a perl program on a unix (HP-UX) host(A) running Oracle 8.1.6
In the program I am trying to connect to another unix (HP-UX) host(B) running Oracle 8.1.7 holding a table c1dwg.

The perl script that runs on host A contains these lines.

$ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/8.1.6';
$ENV{'ORACLE_SID'} = 'CAD';

use DBI;
$dbh = DBI->connect('dbi:Oracle:Mycad4prod', '<user>', ''<password') || die "Could not connect: $DBI::errstr";

$stmt = "SELECT count(*) from c1dwg";
$sth = $dbh->prepare("stmt") || die "Could not Select: $DBI::errstr";
$sth->execute || die "Could not execute: $DBI::errstr";

$sth->finish;

The tnsnames.ora file on host A specifies 'Mycad4prod', specified in the above perl script, as below

MYCAD4PROD.coned.com =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = m020cad4) (PORT=1521)) )
(CONNECT_DATA =
(SERVICE_NAME = meta817.world) ) )

In the above, m020cad4 is the name of host B that I am trying to connect to from A

ORA-12541: TNS: no listener (DBD ERROR:OCIServerAttach) at < the line number in the program that ran in to the problem
Could not connect: ORA-12541: TNS: no listener .. the same thing as above ..

I stopped and started the listener again but did not help

Could any one help, Please.

Thanks

Search Discussions

  • Reidy, Ron at Mar 23, 2005 at 7:53 pm
    This is not a DBI issue.

    However, from oerr:

    $ oerr ora 12514
    12514, 00000, "TNS:listener could not resolve SERVICE_NAME given in connect descriptor"
    // *Cause: The SERVICE_NAME in the CONNECT_DATA was not found in
    // the listener's tables.
    // *Action: Check to make sure that the SERVICE_NAME specified is correct.
    // *Comment: This error will be returned if the (database) service has not been
    // registered with the listener; a database instance that is part of this
    // service may need to be started or configured properly.

    This means one of several things:

    1. Your parameter 'local_listener' is incorrect or non-existent.
    2. Your sqlnet.ora parameter names.default_domain is not correct.
    3. You have the TNS_ADMIN env variable set.
    4. You have an error in your tnsnames.ora file.

    So, what does your sqlnet.ora look like?

    Can you connect via SQL*Plus from the machine where you are having these issues?

    You need to consult with your DBA.

    -----------------
    Ron Reidy
    Lead DBA
    Array BioPharma, Inc.


    -----Original Message-----
    From: Kairam, Raj
    Sent: Wednesday, March 23, 2005 12:25 PM
    To: dbi-users@perl.org
    Subject: Unable to connect to Oracle on another Unix host in a perl
    programming using DBI


    To those who could help me with a problem connecting to an Oracle database on HP-UX from within a perl script that uses DBI

    I have a perl program on a unix (HP-UX) host(A) running Oracle 8.1.6
    In the program I am trying to connect to another unix (HP-UX) host(B) running Oracle 8.1.7 holding a table c1dwg.

    The perl script that runs on host A contains these lines.

    $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/8.1.6';
    $ENV{'ORACLE_SID'} = 'CAD';

    use DBI;
    $dbh = DBI->connect('dbi:Oracle:Mycad4prod', '<user>', ''<password') || die "Could not connect: $DBI::errstr";

    $stmt = "SELECT count(*) from c1dwg";
    $sth = $dbh->prepare("stmt") || die "Could not Select: $DBI::errstr";
    $sth->execute || die "Could not execute: $DBI::errstr";

    $sth->finish;

    The tnsnames.ora file on host A specifies 'Mycad4prod', specified in the above perl script, as below

    MYCAD4PROD.coned.com =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = m020cad4) (PORT=1521)) )
    (CONNECT_DATA =
    (SERVICE_NAME = meta817.world) ) )

    In the above, m020cad4 is the name of host B that I am trying to connect to from A

    ORA-12541: TNS: no listener (DBD ERROR:OCIServerAttach) at < the line number in the program that ran in to the problem
    Could not connect: ORA-12541: TNS: no listener .. the same thing as above ..

    I stopped and started the listener again but did not help

    Could any one help, Please.

    Thanks



    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.
  • David N Murray at Mar 23, 2005 at 7:54 pm
    Does 'tnsping Mycad4prod' work from host(A)? I created a service
    called test.xyz.com. 'tnsping test' fails (TNS-03505: Failed to resolve
    name), but 'tnsping test.xyz.com' works. This doesn't sound like a DBI
    issue at this point.

    On Mar 23, Kairam, Raj scribed:
    To those who could help me with a problem connecting to an Oracle database on HP-UX from within a perl script that uses DBI

    I have a perl program on a unix (HP-UX) host(A) running Oracle 8.1.6
    In the program I am trying to connect to another unix (HP-UX) host(B) running Oracle 8.1.7 holding a table c1dwg.

    The perl script that runs on host A contains these lines.

    $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/8.1.6';
    $ENV{'ORACLE_SID'} = 'CAD';

    use DBI;
    $dbh = DBI->connect('dbi:Oracle:Mycad4prod', '<user>', ''<password') || die "Could not connect: $DBI::errstr";

    $stmt = "SELECT count(*) from c1dwg";
    $sth = $dbh->prepare("stmt") || die "Could not Select: $DBI::errstr";
    $sth->execute || die "Could not execute: $DBI::errstr";

    $sth->finish;

    The tnsnames.ora file on host A specifies 'Mycad4prod', specified in the above perl script, as below

    MYCAD4PROD.coned.com =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = m020cad4) (PORT=1521)) )
    (CONNECT_DATA =
    (SERVICE_NAME = meta817.world) ) )

    In the above, m020cad4 is the name of host B that I am trying to connect to from A

    ORA-12541: TNS: no listener (DBD ERROR:OCIServerAttach) at < the line number in the program that ran in to the problem
    Could not connect: ORA-12541: TNS: no listener .. the same thing as above ..

    I stopped and started the listener again but did not help

    Could any one help, Please.

    Thanks

  • Steven Lembark at Apr 4, 2005 at 4:36 am
    -- "Kairam, Raj" <KairamR@coned.com>
    To those who could help me with a problem connecting to an Oracle
    database on HP-UX from within a perl script that uses DBI
    I have a perl program on a unix (HP-UX) host(A) running Oracle 8.1.6
    In the program I am trying to connect to another unix (HP-UX) host(B)
    running Oracle 8.1.7 holding a table c1dwg.
    The perl script that runs on host A contains these lines.

    $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/8.1.6';
    $ENV{'ORACLE_SID'} = 'CAD';

    use DBI;
    $dbh = DBI->connect('dbi:Oracle:Mycad4prod', '<user>', ''<password') ||
    Just for the fun of it try:

    my $dbh = DBI->connect
    (
    "dbi:Oracle:host=$ip_address;sid=$sid",
    $user,
    $pass
    );

    The point here is to bypass any other issues and see
    if you can reach a tnslsnr on the IP address with an
    explicit ORACLE_SID value.

    --
    Steven Lembark 85-09 90th Street
    Workhorse Computing Woodhaven, NY 11421
    lembark@wrkhors.com 1 888 359 3508

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedMar 23, '05 at 7:25p
activeApr 4, '05 at 4:36a
posts4
users4
websitedbi.perl.org

People

Translate

site design / logo © 2022 Grokbase