Re: (Fwd) Oracle.pm
On 8/3/17 3:45 am, Bruce Johnson wrote: On Mar 6, 2017, at 5:59 PM, Gowtham> wrote: Hi Ron, I did that. I have two scenarios here. Both the scenarios have same ($dbh,$dbname,$user,$auth,$attr) values. Scenario 1: executed code with ORACLE_HOME set to correct value. Scenario 2: executed code with incorrect/wrong ORACLE_HOME env variable. - So my code returns undef in the second scenario. I'm trying to understand the execution part inside the subroutine _login to establish the dependency of ORACLE_HOME on DBI connection. $ORACLE_HOME is critical to any API involving oracle; this is not a function of _login or exclusive to DBI. If it’s set incorrectly or undef, you will always get a failure like this. Without more details on your particular application, it’s difficult to determine why your script is failing, but most common is that the perl module is executed via some sort of process spawning a new shell and the environment in that shell is not properly set. What you need to ensure that the environment variable $ORACLE_HOME is set in the process that is failing; either explicitly in the perl script via $ENV{‘ORACLE_HOME’}= 'path to oracle_home’; or by ensuring that the defaults for the process include that variable. In Apache you can set it via a SetEnv statement: SetEnv ORACLE_HOME /path/to/oracle/home Be aware that more than just ORACLE_HOME is needed, you also need to set LD_LIBRARY_PATH at a minimum, and perhaps TNS_ADMIN , ORACLE_BASE and ORACLE_SID. -- Bruce Johnson University of Arizona College of Pharmacy Information Technology Group Institutions do not have opinions, merely customs As a general reminder for future people stumbling upon this thread, ORACLE_HOME is only needed if the code/driver/app is linking with the Oracle libraries from a full Oracle DB install, or with the full Oracle client install. The variable is not needed (and almost never should be set) if using Oracle Instant Client. Chris -- http://twitter.com/ghrd
Re: (Fwd) Oracle.pm
Hi dbi-users, Any luck on the below Q? Thanks - Gautam Sent from my iPhone > On Mar 6, 2017, at 6:59 PM, Gowthamwrote: > > Hi Ron, > > I did that. > I have two scenarios here. Both the scenarios have same > ($dbh,$dbname,$user,$auth,$attr) values. > Scenario 1: executed code with ORACLE_HOME set to correct value. > > Scenario 2: executed code with incorrect/wrong ORACLE_HOME env variable. > > - So my code returns undef in the second scenario. I'm trying to understand > the execution part inside the subroutine _login to establish the dependency > of ORACLE_HOME on DBI connection. > > - Curious to know the definition for _login() as this is subroutine from the > same Oracle.pm module and this helps me to make some changes as per my > requirement. > > Let me know for any questions. > > Thanks - Gautam > > Sent from my iPhone > >> On Mar 6, 2017, at 6:00 PM, Ron Savage wrote: >> >> Hi Gautam >> >> You don't need to examine the source code of Oracle.pm. You need to print >> out the values of ($dbh,$dbname,$user,$auth,$attr) and focus purely on them, >> and how they differ from what Oracle.pm expects. >> >>> On 07/03/17 10:22, Tim Bunce wrote: >>> - Forwarded message from Gowtham - >>> >>> Date: Mon, 6 Mar 2017 15:40:59 -0600 >>> From: Gowtham >>> To: tim.bu...@pobox.com >>> Subject: Oracle.pm >>> >>> Hi Tim, >>> >>> I feel that you are the right person to check this with. >>> >>> I am trying to understand the code on Oracle.pm (DBD::Oracle) to debug my >>> perl code which tries to make a connection to an Oracle DB. My code exits >>> on the below piece of code on debug mode and i am unable to establish the >>> reason for it. >>> DBD::Oracle::db::_login($dbh,$dbname,$user,$auth,$attr) or return undef; >>> >>> I am unable to find the definition for the subroutine _login() which will >>> help me to understand the reason for returning 'undef'. Could you please >>> kindly advice me. >>> >>> Correct me if i have reached a wrong email. >>> >>> Thanks - Gautam >>> >>> - End forwarded message - >>> >> >> -- >> Ron Savage - savage.net.au
Re: (Fwd) Oracle.pm
On Mar 6, 2017, at 5:59 PM, Gowtham> wrote: Hi Ron, I did that. I have two scenarios here. Both the scenarios have same ($dbh,$dbname,$user,$auth,$attr) values. Scenario 1: executed code with ORACLE_HOME set to correct value. Scenario 2: executed code with incorrect/wrong ORACLE_HOME env variable. - So my code returns undef in the second scenario. I'm trying to understand the execution part inside the subroutine _login to establish the dependency of ORACLE_HOME on DBI connection. $ORACLE_HOME is critical to any API involving oracle; this is not a function of _login or exclusive to DBI. If it’s set incorrectly or undef, you will always get a failure like this. Without more details on your particular application, it’s difficult to determine why your script is failing, but most common is that the perl module is executed via some sort of process spawning a new shell and the environment in that shell is not properly set. What you need to ensure that the environment variable $ORACLE_HOME is set in the process that is failing; either explicitly in the perl script via $ENV{‘ORACLE_HOME’}= 'path to oracle_home’; or by ensuring that the defaults for the process include that variable. In Apache you can set it via a SetEnv statement: SetEnv ORACLE_HOME /path/to/oracle/home Be aware that more than just ORACLE_HOME is needed, you also need to set LD_LIBRARY_PATH at a minimum, and perhaps TNS_ADMIN , ORACLE_BASE and ORACLE_SID. -- Bruce Johnson University of Arizona College of Pharmacy Information Technology Group Institutions do not have opinions, merely customs
Re: (Fwd) Oracle.pm
Hi Ron, I did that. I have two scenarios here. Both the scenarios have same ($dbh,$dbname,$user,$auth,$attr) values. Scenario 1: executed code with ORACLE_HOME set to correct value. Scenario 2: executed code with incorrect/wrong ORACLE_HOME env variable. - So my code returns undef in the second scenario. I'm trying to understand the execution part inside the subroutine _login to establish the dependency of ORACLE_HOME on DBI connection. - Curious to know the definition for _login() as this is subroutine from the same Oracle.pm module and this helps me to make some changes as per my requirement. Let me know for any questions. Thanks - Gautam Sent from my iPhone > On Mar 6, 2017, at 6:00 PM, Ron Savagewrote: > > Hi Gautam > > You don't need to examine the source code of Oracle.pm. You need to print out > the values of ($dbh,$dbname,$user,$auth,$attr) and focus purely on them, and > how they differ from what Oracle.pm expects. > >> On 07/03/17 10:22, Tim Bunce wrote: >> - Forwarded message from Gowtham - >> >> Date: Mon, 6 Mar 2017 15:40:59 -0600 >> From: Gowtham >> To: tim.bu...@pobox.com >> Subject: Oracle.pm >> >> Hi Tim, >> >> I feel that you are the right person to check this with. >> >> I am trying to understand the code on Oracle.pm (DBD::Oracle) to debug my >> perl code which tries to make a connection to an Oracle DB. My code exits on >> the below piece of code on debug mode and i am unable to establish the >> reason for it. >> DBD::Oracle::db::_login($dbh,$dbname,$user,$auth,$attr) or return undef; >> >> I am unable to find the definition for the subroutine _login() which will >> help me to understand the reason for returning 'undef'. Could you please >> kindly advice me. >> >> Correct me if i have reached a wrong email. >> >> Thanks - Gautam >> >> - End forwarded message - >> > > -- > Ron Savage - savage.net.au
Re: (Fwd) Oracle.pm
Hi Gautam P.S. Do not reply to me directly. Always reply to the DBI Users list. On 07/03/17 11:00, Ron Savage wrote: Hi Gautam You don't need to examine the source code of Oracle.pm. You need to print out the values of ($dbh,$dbname,$user,$auth,$attr) and focus purely on them, and how they differ from what Oracle.pm expects. On 07/03/17 10:22, Tim Bunce wrote: - Forwarded message from Gowtham- Date: Mon, 6 Mar 2017 15:40:59 -0600 From: Gowtham To: tim.bu...@pobox.com Subject: Oracle.pm Hi Tim, I feel that you are the right person to check this with. I am trying to understand the code on Oracle.pm (DBD::Oracle) to debug my perl code which tries to make a connection to an Oracle DB. My code exits on the below piece of code on debug mode and i am unable to establish the reason for it. DBD::Oracle::db::_login($dbh,$dbname,$user,$auth,$attr) or return undef; I am unable to find the definition for the subroutine _login() which will help me to understand the reason for returning 'undef'. Could you please kindly advice me. Correct me if i have reached a wrong email. Thanks - Gautam - End forwarded message - -- Ron Savage - savage.net.au
Re: (Fwd) Oracle.pm
Hi Gautam You don't need to examine the source code of Oracle.pm. You need to print out the values of ($dbh,$dbname,$user,$auth,$attr) and focus purely on them, and how they differ from what Oracle.pm expects. On 07/03/17 10:22, Tim Bunce wrote: - Forwarded message from Gowtham- Date: Mon, 6 Mar 2017 15:40:59 -0600 From: Gowtham To: tim.bu...@pobox.com Subject: Oracle.pm Hi Tim, I feel that you are the right person to check this with. I am trying to understand the code on Oracle.pm (DBD::Oracle) to debug my perl code which tries to make a connection to an Oracle DB. My code exits on the below piece of code on debug mode and i am unable to establish the reason for it. DBD::Oracle::db::_login($dbh,$dbname,$user,$auth,$attr) or return undef; I am unable to find the definition for the subroutine _login() which will help me to understand the reason for returning 'undef'. Could you please kindly advice me. Correct me if i have reached a wrong email. Thanks - Gautam - End forwarded message - -- Ron Savage - savage.net.au