Results 1 to 4 of 4
  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
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Oracle Connectivity with PERL

    Originally posted by adityanlal
    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
    Possible you don't have an entry for target database in tnsnames.ora

  3. #3
    Join Date
    Jul 2003
    Location
    Calcutta, India
    Posts
    42
    In tnsnames.ora the database name is there as when running the same script manually I am able to get the result. However when running through scheduler I am getting this TNS error. I have set the following env. variables:
    1. ORACLE_HOME
    2. ORALCE_BASE
    3. PATH
    4. ORACLE_SID
    5. TWO_TASK

    Do I need to set any more environment variables.....

    Thanks a lor for your help......
    Waiting from your reply.........

  4. #4
    Join Date
    Jul 2003
    Location
    Calcutta, India
    Posts
    42
    Thanks ika for helping, now I am using this command from PERL script to connect with Oracle DB. This works fine both while running the script manually and with Scheduler.
    $dbh = DBI->connect('dbi:Oracle:host=<hostname>;sid=<sid name>;port=<port No>', $usr, $passwd, { RaiseError => 1, AutoCommit => 0 });

    Thanks
    adityanlal

Posting Permissions

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