Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Location
    Calcutta, India
    Posts
    42

    Unanswered: Oracle Connectivity with PERL

    Hi!

    I have an application running in PERL Script and now we require to connect PERL with ORacle database. After doing some research work and getting helps from this site somehow I am able to connect with the Oracle database from PERL. However when I run the script(s) manuaaly it works fine, the script connects to Oracle, read/write, commit/rollback and exit from the Database. But when the same script I tried to run through some job scheduler like "autotsys" (a s/w which schedules the job on Solaris env) the script(s) fails and it gives an error saying "ORA-12154: TNS: Could Not resolve service name(DBD: Error: OCIServerAttach)".
    Afterwards I set some environment variables required to connect to the Oracle database before the "onnect" command i.e. "ORACLE_HOME" and "TWO_TASK". So we need any other env. variables to connect to Oracle database. Please note here that "Autosys" is unale to read the env. variables from the shell environment.

    I need your help. Thanks in advance

    Aditya N Lal

  2. #2
    Join Date
    Nov 2003
    Posts
    19
    Usually when executing form the cron
    u need

    ORACLE_HOME
    ORACLE_SID
    ORACLE_BASE
    PATH=$PATH:$ORACLE_HOME/bin

  3. #3
    Join Date
    Jul 2003
    Location
    Calcutta, India
    Posts
    42
    Originally posted by agstamy
    Usually when executing form the cron
    u need

    ORACLE_HOME
    ORACLE_SID
    ORACLE_BASE
    PATH=$PATH:$ORACLE_HOME/bin
    Thanks for the reply. But sorry to say that even after setting these env. variables, I am getting the same error of ORA-12154: TNS:could not resolve service name (DBD ERROR: OCIServerAttach)....

    Need your help like anything.....Thanks in advance

  4. #4
    Join Date
    Nov 2003
    Posts
    19
    Try setting also

    export TNS_ADMIN=$ORACLE_HOME/network/admin

    export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    At least for me on Solaris PERL's DBD/DBI interface is case sensitive when it comes to entries in the tnsnames.ora file. Another "GOTCHA" is
    whether or not within your sqlnet.ora "NAMES.DEFAULT_DOMAIN" is defined (or not). Ideally if/when you can successfully connect to the DB in question using "sqlplus username/password@alias", then you should be able to use the same alias for PERL; because PERL use the exact same mechanism as SQL*PLUS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •