Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Jerome MOUREAUX

I tried your proposition, then I tried the following:

my $dbh = DBI->connect( 
'DBI:Oracle:host=myserver.rms.slb.com;sid=INDICATORS;port=1526', 
'indic/xxx', '',
 { AutoCommit => 0, RaiseError => 0, PrintError => 1 } )
 or die $DBI::errstr;

and now I get a new error:

DBI->connect failed: ORA-12157: TNS:internal network communication error 
(DBD: l
ogin failed) at /disc1/sherpa_a/indicators2/perl/toto.pl line 5
[Thu Mar 30 09:31:16 2000] [error] ORA-12157: TNS:internal network 
communication
  error (DBD: login failed) at /disc1/sherpa_a/indicators2/perl/toto.pl line 5.

Any idea with this new error code which is ? Here is the Oracle error 
description:
Should I post this error in the DBI mailing list ?

ORA-12157 TNS:Internal network communication error

  Cause:
 Internal error during network communication.

  Action:
 Not normally visible to the user. For further details, turn on 
tracing and reexecute the operation. If error persists, contact Worldwide 
Customer Support.

At 04:28 PM 29-03-00 -0500, David S . Kenzik wrote:
>A final effort... From the command line it works. Perhaps your ORACLE_USERID,
>etc. is already set?
>
>Within your Registry script, that's probably not the case unless you've
>explicitly told it otherwise.
>
>So let's change your DSN around a bit:
>
> my $dbh = DBI->connect('dbi:Oracle:', 'indic/xxx@INDICATORS', '',
> { AutoCommit => 0, RaiseError => 0, PrintError => 1 } ) or die 
> $DBI::errstr;
>
>I don't use the same format of the connect string that you are showing in
>your example below (I use the format above.) In fact, I vaguely remember
>encountering a similar problem when using a 'typical' connect string with
>other DB's.
>
>I'm hoping that something in your current environment is set allowing that
>format to work, when in actuality it's the improper way.
>
>Let's see if this works. If not, I'm out of ideas. :-(
>
>Good luck!
>
>-d.
>
>   David S . Kenzik said...
>
>  > My mistake, Jerome.
>  >
>  > PerlSetVar != PerlSetEnv
>  >
>  > I read that as PerlSetVar. Sorry to confuse the issue.
>  >
>  > I hope it's a simple permissions problem.
>  >
>  > Good luck!
>  >
>  >   David S . Kenzik said...
>  >
>  >  >   Jerome MOUREAUX said...
>  >  >
>  >  >  > David,
>  >  >  >
>  >  >  > The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv 
> directive.
>  >  >  > (it appears in the extract I sent). (I've checked that is OK in 
> the scripts by
>  >  >  > printing out $ENV{ORACLE_HOME} )
>  >  >
>  >  > Well I can pretty much guarantee you that the ORACLE_HOME 
> environment is not
>  >  > being set by PerlSetVar. That is simply not the function of 
> PerlSetVar.
>  >  >
>  >  > You must have it set globally in /etc/profile or similar if you're 
> able to
>  >  > print it. And if you are indeed able to print it, then it not being 
> set is
>  >  > not your problem.
>  >  >
>  >  > Just to humour me, please set it in your startup.pl like my example 
> shows,
>  >  > and remove the PerlSetVar line in your httpd.conf. Try again. If 
> the problem
>  >  > persists, it's something else. Maybe permissions...
>  >  >
>  >  > Does the webserver user have rights to look at tnsnames.ora and other
>  >  > items inside /disc1/sherpa/oracle? To verify, su into your 
> webserver user
>  >  > and attempt to run your script from the command line.
>  >  >
>  >  >  > The SID is not case sensitive (I tried some combination when I 
> was trying to
>  >  >  > figure out what happen) otherwise it would mean that SID are 
> insensitive when
>  >  >  > running the script from command line and sensitive when running 
> from Apache !
>  >  >
>  >  > OK. It's not case sensitive. I've learned something new today, and 
> verified
>  >  > by reconfiguring my tnsnames.ora.
>  >  >
>  >  > Good luck.
>  >  >
>  >  >  > At 03:43 PM 29-03-00 -0500, David S . Kenzik wrote:
>  >  >  >
>  >  >  > >The ORACLE_HOME ___environment___ variable is set where? I see 
> no indication
>  >  >  > >of it being set in any of your examples or config.
>  >  >  > >
>  >  >  > >I do see PerlSetVar setting it-- don't confuse that with the 
> environment!
>  >  >  > >PerlSetVar is a specific way to set variables so mod_perl can 
> read them via
>  >  >  > >the dir_config() method.
>  >  >  > >
>  >  >  > >I usually set my ORACLE_HOME inside my startup.pl so all the 
> Apache children
>  >  >  > >can definitely find it:
>  >  >  > >
>  >  >  > > $ENV{ORACLE_HOME}='/disc1/sherpa/oracle';
>  >  >  > >
>  >  >  > >You might also be able to use Apache's SetEnv directive, see 
> the following
>  >  >  > >URL for details and possible restrictions:
>  >  >  > >
>  >  >  > > http://www.apache.org/docs/mod/mod_env.html#setenv
>  >  >  > >
>  >  >  > >And finally, you should double check your case in your DSN 
> during your
>  >  >  > >connect(). Oracle SIDs might be case sensitive and thus not 
> finding the
>  >  >  > >proper SID. (I always have SIDs that are all capital letters,

Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Alan E. Derhaag

Jerome MOUREAUX <[EMAIL PROTECTED]> writes:

> David,
> 
> The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv directive.
> (it appears in the extract I sent). (I've checked that is OK in the scripts by
> printing out $ENV{ORACLE_HOME} )
> The SID is not case sensitive (I tried some combination when I was trying to
> figure out what happen) otherwise it would mean that SID are insensitive when
> running the script from command line and sensitive when running from Apache !

[...]

> >  > Here is the error :
> >  >
> >  > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
> >  > login f
> >  > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
> >  > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
> > service
> >  > name
> >  >   (DBD: login failed) at 
> > /disc1/sherpa_a/indicators2/perl/activity/toto.pl
> >  > line 5
> >  >

[...]

> >  > #$Apache::DBI::DEBUG=2;
> >  > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
> >  >   { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
> >  >   or die $DBI::errstr;
> >  >
> >  > 1;

Have you tried something like:

Apache::DBI->connect_on_init("dbi:Oracle:server=indicators;database=XXX",
  "indic", "", { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
   or die $DBI::errstr;

explicitly supplying the server and avoiding the `use XXX' on the
first connect?  Works with Sybase, anyway.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Alan E. DerhaagConsultant from Interactive Business Systems
phone: 206-336-2972  Consultant to N2H2
email: [EMAIL PROTECTED]   [EMAIL PROTECTED]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Perrin Harkins

On Wed, 29 Mar 2000, Jerome MOUREAUX wrote:
> My scripts run well if I launch it from the command line.

Have you tried running them from the command line as the user who the
webserver runs as?  There may be something in your user environment that
allows them to work which is not set up for this other user.

- Perrin




Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread John D Groenveld

Write a small registry script to print %ENV and confirm ORACLE_HOME is set to
/disc1/sherpa/oracle.

In your shell,
# cat 

Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread David S . Kenzik

A final effort... From the command line it works. Perhaps your ORACLE_USERID,
etc. is already set? 

Within your Registry script, that's probably not the case unless you've
explicitly told it otherwise.

So let's change your DSN around a bit:

my $dbh = DBI->connect('dbi:Oracle:', 'indic/xxx@INDICATORS', '', 
{ AutoCommit => 0, RaiseError => 0, PrintError => 1 } ) or die $DBI::errstr;

I don't use the same format of the connect string that you are showing in
your example below (I use the format above.) In fact, I vaguely remember
encountering a similar problem when using a 'typical' connect string with
other DB's.

I'm hoping that something in your current environment is set allowing that
format to work, when in actuality it's the improper way.

Let's see if this works. If not, I'm out of ideas. :-(

Good luck!

-d.

  David S . Kenzik said...

 > My mistake, Jerome. 
 > 
 > PerlSetVar != PerlSetEnv
 > 
 > I read that as PerlSetVar. Sorry to confuse the issue.
 > 
 > I hope it's a simple permissions problem.
 > 
 > Good luck!
 > 
 >   David S . Kenzik said...
 > 
 >  >   Jerome MOUREAUX said...
 >  > 
 >  >  > David,
 >  >  > 
 >  >  > The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv directive.
 >  >  > (it appears in the extract I sent). (I've checked that is OK in the scripts by
 >  >  > printing out $ENV{ORACLE_HOME} )
 >  > 
 >  > Well I can pretty much guarantee you that the ORACLE_HOME environment is not
 >  > being set by PerlSetVar. That is simply not the function of PerlSetVar. 
 >  > 
 >  > You must have it set globally in /etc/profile or similar if you're able to
 >  > print it. And if you are indeed able to print it, then it not being set is
 >  > not your problem.
 >  > 
 >  > Just to humour me, please set it in your startup.pl like my example shows,
 >  > and remove the PerlSetVar line in your httpd.conf. Try again. If the problem
 >  > persists, it's something else. Maybe permissions...
 >  > 
 >  > Does the webserver user have rights to look at tnsnames.ora and other
 >  > items inside /disc1/sherpa/oracle? To verify, su into your webserver user
 >  > and attempt to run your script from the command line. 
 >  > 
 >  >  > The SID is not case sensitive (I tried some combination when I was trying to
 >  >  > figure out what happen) otherwise it would mean that SID are insensitive when
 >  >  > running the script from command line and sensitive when running from Apache !
 >  > 
 >  > OK. It's not case sensitive. I've learned something new today, and verified
 >  > by reconfiguring my tnsnames.ora.
 >  > 
 >  > Good luck.
 >  > 
 >  >  > At 03:43 PM 29-03-00 -0500, David S . Kenzik wrote:
 >  >  >
 >  >  > >The ORACLE_HOME ___environment___ variable is set where? I see no indication
 >  >  > >of it being set in any of your examples or config.
 >  >  > >
 >  >  > >I do see PerlSetVar setting it-- don't confuse that with the environment!
 >  >  > >PerlSetVar is a specific way to set variables so mod_perl can read them via
 >  >  > >the dir_config() method.
 >  >  > >
 >  >  > >I usually set my ORACLE_HOME inside my startup.pl so all the Apache children
 >  >  > >can definitely find it:
 >  >  > >
 >  >  > > $ENV{ORACLE_HOME}='/disc1/sherpa/oracle';
 >  >  > >
 >  >  > >You might also be able to use Apache's SetEnv directive, see the following
 >  >  > >URL for details and possible restrictions:
 >  >  > >
 >  >  > > http://www.apache.org/docs/mod/mod_env.html#setenv
 >  >  > >
 >  >  > >And finally, you should double check your case in your DSN during your
 >  >  > >connect(). Oracle SIDs might be case sensitive and thus not finding the
 >  >  > >proper SID. (I always have SIDs that are all capital letters, so I couldn't
 >  >  > >tell you for sure.)
 >  >  > >
 >  >  > >Hope this helps.
 >  >  > >
 >  >  > >-d.
 >  >  > >
 >  >  > >   Jerome MOUREAUX said...
 >  >  > >
 >  >  > >  > Hi All,
 >  >  > >  >
 >  >  > >  > I experience a trouble with Perl script using DBI running under Mod_perl
 >  >  > >  > and Registry
 >  >  > >  > If you have an idea from where the problem may come
 >  >  > >  >
 >  >  > >  > Here is the error :
 >  >  > >  >
 >  >  > >  > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
 >  >  > >  > login f
 >  >  > >  > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
 >  >  > >  > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
 >  >  > > service
 >  >  > >  > name
 >  >  > >  >   (DBD: login failed) at 
 >  >  > > /disc1/sherpa_a/indicators2/perl/activity/toto.pl
 >  >  > >  > line 5
 >  >  > >  >
 >  >  > >  > The ORACLE_HOME is well set ! I first tried to use Apache::DBI but i get
 >  >  > >  > this error
 >  >  > >  > so I go back to DBI only but it's exactly the same error.
 >  >  > >  > My scripts run well if I launch it from the command line.
 >  >  > >  >
 >  >  > >  > Here is extracts of my httpd.conf
 >  >  > >  >
 >  >  > >  >  # Additionnal directory (f

Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Perrin Harkins

On Wed, 29 Mar 2000, Jerome MOUREAUX wrote:
>  Alias /indicators2/perl "/disc1/sherpa_a/indicators2/perl"
[...]
> PerlSetEnv  ORACLE_HOME /disc1/sherpa/oracle

Do you really have a /disc1/sherpa directory and a /disc1/sherpa_a
directory?

- Perrin




Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread David S . Kenzik

My mistake, Jerome. 

PerlSetVar != PerlSetEnv

I read that as PerlSetVar. Sorry to confuse the issue.

I hope it's a simple permissions problem.

Good luck!

  David S . Kenzik said...

 >   Jerome MOUREAUX said...
 > 
 >  > David,
 >  > 
 >  > The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv directive.
 >  > (it appears in the extract I sent). (I've checked that is OK in the scripts by
 >  > printing out $ENV{ORACLE_HOME} )
 > 
 > Well I can pretty much guarantee you that the ORACLE_HOME environment is not
 > being set by PerlSetVar. That is simply not the function of PerlSetVar. 
 > 
 > You must have it set globally in /etc/profile or similar if you're able to
 > print it. And if you are indeed able to print it, then it not being set is
 > not your problem.
 > 
 > Just to humour me, please set it in your startup.pl like my example shows,
 > and remove the PerlSetVar line in your httpd.conf. Try again. If the problem
 > persists, it's something else. Maybe permissions...
 > 
 > Does the webserver user have rights to look at tnsnames.ora and other
 > items inside /disc1/sherpa/oracle? To verify, su into your webserver user
 > and attempt to run your script from the command line. 
 > 
 >  > The SID is not case sensitive (I tried some combination when I was trying to
 >  > figure out what happen) otherwise it would mean that SID are insensitive when
 >  > running the script from command line and sensitive when running from Apache !
 > 
 > OK. It's not case sensitive. I've learned something new today, and verified
 > by reconfiguring my tnsnames.ora.
 > 
 > Good luck.
 > 
 >  > At 03:43 PM 29-03-00 -0500, David S . Kenzik wrote:
 >  >
 >  > >The ORACLE_HOME ___environment___ variable is set where? I see no indication
 >  > >of it being set in any of your examples or config.
 >  > >
 >  > >I do see PerlSetVar setting it-- don't confuse that with the environment!
 >  > >PerlSetVar is a specific way to set variables so mod_perl can read them via
 >  > >the dir_config() method.
 >  > >
 >  > >I usually set my ORACLE_HOME inside my startup.pl so all the Apache children
 >  > >can definitely find it:
 >  > >
 >  > > $ENV{ORACLE_HOME}='/disc1/sherpa/oracle';
 >  > >
 >  > >You might also be able to use Apache's SetEnv directive, see the following
 >  > >URL for details and possible restrictions:
 >  > >
 >  > > http://www.apache.org/docs/mod/mod_env.html#setenv
 >  > >
 >  > >And finally, you should double check your case in your DSN during your
 >  > >connect(). Oracle SIDs might be case sensitive and thus not finding the
 >  > >proper SID. (I always have SIDs that are all capital letters, so I couldn't
 >  > >tell you for sure.)
 >  > >
 >  > >Hope this helps.
 >  > >
 >  > >-d.
 >  > >
 >  > >   Jerome MOUREAUX said...
 >  > >
 >  > >  > Hi All,
 >  > >  >
 >  > >  > I experience a trouble with Perl script using DBI running under Mod_perl
 >  > >  > and Registry
 >  > >  > If you have an idea from where the problem may come
 >  > >  >
 >  > >  > Here is the error :
 >  > >  >
 >  > >  > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
 >  > >  > login f
 >  > >  > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
 >  > >  > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
 >  > > service
 >  > >  > name
 >  > >  >   (DBD: login failed) at 
 >  > > /disc1/sherpa_a/indicators2/perl/activity/toto.pl
 >  > >  > line 5
 >  > >  >
 >  > >  > The ORACLE_HOME is well set ! I first tried to use Apache::DBI but i get
 >  > >  > this error
 >  > >  > so I go back to DBI only but it's exactly the same error.
 >  > >  > My scripts run well if I launch it from the command line.
 >  > >  >
 >  > >  > Here is extracts of my httpd.conf
 >  > >  >
 >  > >  >  # Additionnal directory (for indicators)
 >  > >  >  Alias /indicators2/perl "/disc1/sherpa_a/indicators2/perl"
 >  > >  >  
 >  > >  >  SetHandler  perl-script
 >  > >  >  PerlHandler Apache::Registry
 >  > >  >  PerlSendHeader  On
 >  > >  >  Options +ExecCGI
 >  > >  >  
 >  > >  >
 >  > >  > at the end:
 >  > >  >
 >  > >  > PerlSetEnv  ORACLE_HOME /disc1/sherpa/oracle
 >  > >  > PerlRequire conf/startup.pl
 >  > >  > PerlFreshRestartOn
 >  > >  >
 >  > >  > Here is the startup.pl
 >  > >  >
 >  > >  > #!/usr/bin/perl
 >  > >  >
 >  > >  > # Commonly used modules
 >  > >  > use Apache::Registry ();
 >  > >  > use Apache::Constants ();
 >  > >  > use CGI ();
 >  > >  > #use Apache::DBI ();
 >  > >  >
 >  > >  > #$Apache::DBI::DEBUG=2;
 >  > >  > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
 >  > >  >   { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
 >  > >  >   or die $DBI::errstr;
 >  > >  >
 >  > >  > 1;
 >  > >  >
 >  > >  > And finally my test file:
 >  > >  >
 >  > >  > #!/usr/bin/perl
 >  > >  >
 >  > >  > use DBI;
 >  > >  >
 >  > >  > my $dbh = DBI

Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread David S . Kenzik

  Jerome MOUREAUX said...

 > David,
 > 
 > The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv directive.
 > (it appears in the extract I sent). (I've checked that is OK in the scripts by
 > printing out $ENV{ORACLE_HOME} )

Well I can pretty much guarantee you that the ORACLE_HOME environment is not
being set by PerlSetVar. That is simply not the function of PerlSetVar. 

You must have it set globally in /etc/profile or similar if you're able to
print it. And if you are indeed able to print it, then it not being set is
not your problem.

Just to humour me, please set it in your startup.pl like my example shows,
and remove the PerlSetVar line in your httpd.conf. Try again. If the problem
persists, it's something else. Maybe permissions...

Does the webserver user have rights to look at tnsnames.ora and other
items inside /disc1/sherpa/oracle? To verify, su into your webserver user
and attempt to run your script from the command line. 

 > The SID is not case sensitive (I tried some combination when I was trying to
 > figure out what happen) otherwise it would mean that SID are insensitive when
 > running the script from command line and sensitive when running from Apache !

OK. It's not case sensitive. I've learned something new today, and verified
by reconfiguring my tnsnames.ora.

Good luck.

 > At 03:43 PM 29-03-00 -0500, David S . Kenzik wrote:
 >
 > >The ORACLE_HOME ___environment___ variable is set where? I see no indication
 > >of it being set in any of your examples or config.
 > >
 > >I do see PerlSetVar setting it-- don't confuse that with the environment!
 > >PerlSetVar is a specific way to set variables so mod_perl can read them via
 > >the dir_config() method.
 > >
 > >I usually set my ORACLE_HOME inside my startup.pl so all the Apache children
 > >can definitely find it:
 > >
 > > $ENV{ORACLE_HOME}='/disc1/sherpa/oracle';
 > >
 > >You might also be able to use Apache's SetEnv directive, see the following
 > >URL for details and possible restrictions:
 > >
 > > http://www.apache.org/docs/mod/mod_env.html#setenv
 > >
 > >And finally, you should double check your case in your DSN during your
 > >connect(). Oracle SIDs might be case sensitive and thus not finding the
 > >proper SID. (I always have SIDs that are all capital letters, so I couldn't
 > >tell you for sure.)
 > >
 > >Hope this helps.
 > >
 > >-d.
 > >
 > >   Jerome MOUREAUX said...
 > >
 > >  > Hi All,
 > >  >
 > >  > I experience a trouble with Perl script using DBI running under Mod_perl
 > >  > and Registry
 > >  > If you have an idea from where the problem may come
 > >  >
 > >  > Here is the error :
 > >  >
 > >  > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
 > >  > login f
 > >  > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
 > >  > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
 > > service
 > >  > name
 > >  >   (DBD: login failed) at 
 > > /disc1/sherpa_a/indicators2/perl/activity/toto.pl
 > >  > line 5
 > >  >
 > >  > The ORACLE_HOME is well set ! I first tried to use Apache::DBI but i get
 > >  > this error
 > >  > so I go back to DBI only but it's exactly the same error.
 > >  > My scripts run well if I launch it from the command line.
 > >  >
 > >  > Here is extracts of my httpd.conf
 > >  >
 > >  >  # Additionnal directory (for indicators)
 > >  >  Alias /indicators2/perl "/disc1/sherpa_a/indicators2/perl"
 > >  >  
 > >  >  SetHandler  perl-script
 > >  >  PerlHandler Apache::Registry
 > >  >  PerlSendHeader  On
 > >  >  Options +ExecCGI
 > >  >  
 > >  >
 > >  > at the end:
 > >  >
 > >  > PerlSetEnv  ORACLE_HOME /disc1/sherpa/oracle
 > >  > PerlRequire conf/startup.pl
 > >  > PerlFreshRestartOn
 > >  >
 > >  > Here is the startup.pl
 > >  >
 > >  > #!/usr/bin/perl
 > >  >
 > >  > # Commonly used modules
 > >  > use Apache::Registry ();
 > >  > use Apache::Constants ();
 > >  > use CGI ();
 > >  > #use Apache::DBI ();
 > >  >
 > >  > #$Apache::DBI::DEBUG=2;
 > >  > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
 > >  >   { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
 > >  >   or die $DBI::errstr;
 > >  >
 > >  > 1;
 > >  >
 > >  > And finally my test file:
 > >  >
 > >  > #!/usr/bin/perl
 > >  >
 > >  > use DBI;
 > >  >
 > >  > my $dbh = DBI->connect( 'DBI:Oracle:INDICATORS', 'indic', ',
 > >  >  { AutoCommit => 0, RaiseError => 0, PrintError => 1 } )
 > >  >  or die $DBI::errstr;
 > >  >
 > >  > $dbh->disconnect;
 > >  >
 > >  > Thanks in advance
 > >  > Jerome

-- 
David S. Kenzik
[EMAIL PROTECTED] - http://kenzik.com



Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Jerome MOUREAUX

David,

The ORACLE_HOME is set in the httpd.conf with a PerlSetEnv directive.
(it appears in the extract I sent). (I've checked that is OK in the scripts by
printing out $ENV{ORACLE_HOME} )
The SID is not case sensitive (I tried some combination when I was trying to
figure out what happen) otherwise it would mean that SID are insensitive when
running the script from command line and sensitive when running from Apache !

Thanks for you help

Regards
Jerome

At 03:43 PM 29-03-00 -0500, David S . Kenzik wrote:
>The ORACLE_HOME ___environment___ variable is set where? I see no indication
>of it being set in any of your examples or config.
>
>I do see PerlSetVar setting it-- don't confuse that with the environment!
>PerlSetVar is a specific way to set variables so mod_perl can read them via
>the dir_config() method.
>
>I usually set my ORACLE_HOME inside my startup.pl so all the Apache children
>can definitely find it:
>
> $ENV{ORACLE_HOME}='/disc1/sherpa/oracle';
>
>You might also be able to use Apache's SetEnv directive, see the following
>URL for details and possible restrictions:
>
> http://www.apache.org/docs/mod/mod_env.html#setenv
>
>And finally, you should double check your case in your DSN during your
>connect(). Oracle SIDs might be case sensitive and thus not finding the
>proper SID. (I always have SIDs that are all capital letters, so I couldn't
>tell you for sure.)
>
>Hope this helps.
>
>-d.
>
>   Jerome MOUREAUX said...
>
>  > Hi All,
>  >
>  > I experience a trouble with Perl script using DBI running under Mod_perl
>  > and Registry
>  > If you have an idea from where the problem may come
>  >
>  > Here is the error :
>  >
>  > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
>  > login f
>  > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
>  > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
> service
>  > name
>  >   (DBD: login failed) at 
> /disc1/sherpa_a/indicators2/perl/activity/toto.pl
>  > line 5
>  >
>  > The ORACLE_HOME is well set ! I first tried to use Apache::DBI but i get
>  > this error
>  > so I go back to DBI only but it's exactly the same error.
>  > My scripts run well if I launch it from the command line.
>  >
>  > Here is extracts of my httpd.conf
>  >
>  >  # Additionnal directory (for indicators)
>  >  Alias /indicators2/perl "/disc1/sherpa_a/indicators2/perl"
>  >  
>  >  SetHandler  perl-script
>  >  PerlHandler Apache::Registry
>  >  PerlSendHeader  On
>  >  Options +ExecCGI
>  >  
>  >
>  > at the end:
>  >
>  > PerlSetEnv  ORACLE_HOME /disc1/sherpa/oracle
>  > PerlRequire conf/startup.pl
>  > PerlFreshRestartOn
>  >
>  > Here is the startup.pl
>  >
>  > #!/usr/bin/perl
>  >
>  > # Commonly used modules
>  > use Apache::Registry ();
>  > use Apache::Constants ();
>  > use CGI ();
>  > #use Apache::DBI ();
>  >
>  > #$Apache::DBI::DEBUG=2;
>  > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
>  >   { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
>  >   or die $DBI::errstr;
>  >
>  > 1;
>  >
>  > And finally my test file:
>  >
>  > #!/usr/bin/perl
>  >
>  > use DBI;
>  >
>  > my $dbh = DBI->connect( 'DBI:Oracle:INDICATORS', 'indic', ',
>  >  { AutoCommit => 0, RaiseError => 0, PrintError => 1 } )
>  >  or die $DBI::errstr;
>  >
>  > $dbh->disconnect;
>  >
>  > Thanks in advance
>  > Jerome
>
>--
>David S. Kenzik
>[EMAIL PROTECTED] - http://kenzik.com





Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Jerome MOUREAUX

Thanks Jeffrey but:

- the tnsname.ora is OK as tnsping works fine as well as the same script run
from the command line.
- the case is only important for Oracle in the string dbi:Oracle:SID
   (the line in startup.pl in commented it was just a previous try)

I'm really running out of idea about this problem. I never had any problem 
with DBI
in other command line perl scripts as well as in traditionnal perl CGI 
scripts so I
think there is something linked to Registry ???

Regards
Jerome

At 10:33 AM 29-03-00 -0800, Jeffrey W. Baker wrote:
>On Wed, 29 Mar 2000, Jerome MOUREAUX wrote:
>
> > Hi All,
> >
> > I experience a trouble with Perl script using DBI running under Mod_perl
> > and Registry
> > If you have an idea from where the problem may come
> >
> > Here is the error :
> >
> > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD:
> > login f
> > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
> > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve 
> service
> > name
> >   (DBD: login failed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl
> > line 5
>
> > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
> ^^
>
> > my $dbh = DBI->connect( 'DBI:Oracle:INDICATORS', 'indic', ',
>   ^^
>
>
>Well, which is it?  indicators or INDICATORS?  Case may be important, use
>the same case as the service name definition in tnsnames.ora.
>
>-jwb





Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread David S . Kenzik

The ORACLE_HOME ___environment___ variable is set where? I see no indication
of it being set in any of your examples or config.

I do see PerlSetVar setting it-- don't confuse that with the environment!
PerlSetVar is a specific way to set variables so mod_perl can read them via
the dir_config() method. 

I usually set my ORACLE_HOME inside my startup.pl so all the Apache children
can definitely find it:

$ENV{ORACLE_HOME}='/disc1/sherpa/oracle';

You might also be able to use Apache's SetEnv directive, see the following
URL for details and possible restrictions:

http://www.apache.org/docs/mod/mod_env.html#setenv

And finally, you should double check your case in your DSN during your
connect(). Oracle SIDs might be case sensitive and thus not finding the
proper SID. (I always have SIDs that are all capital letters, so I couldn't
tell you for sure.)

Hope this helps.

-d.

  Jerome MOUREAUX said...

 > Hi All,
 > 
 > I experience a trouble with Perl script using DBI running under Mod_perl 
 > and Registry
 > If you have an idea from where the problem may come
 > 
 > Here is the error :
 > 
 > DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD: 
 > login f
 > ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
 > [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve service 
 > name
 >   (DBD: login failed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl 
 > line 5
 > 
 > The ORACLE_HOME is well set ! I first tried to use Apache::DBI but i get 
 > this error
 > so I go back to DBI only but it's exactly the same error.
 > My scripts run well if I launch it from the command line.
 > 
 > Here is extracts of my httpd.conf
 > 
 >  # Additionnal directory (for indicators)
 >  Alias /indicators2/perl "/disc1/sherpa_a/indicators2/perl"
 >  
 >  SetHandler  perl-script
 >  PerlHandler Apache::Registry
 >  PerlSendHeader  On
 >  Options +ExecCGI
 >  
 > 
 > at the end:
 > 
 > PerlSetEnv  ORACLE_HOME /disc1/sherpa/oracle
 > PerlRequire conf/startup.pl
 > PerlFreshRestartOn
 > 
 > Here is the startup.pl
 > 
 > #!/usr/bin/perl
 > 
 > # Commonly used modules
 > use Apache::Registry ();
 > use Apache::Constants ();
 > use CGI ();
 > #use Apache::DBI ();
 > 
 > #$Apache::DBI::DEBUG=2;
 > #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
 >   { AutoCommit => 0, RaiseError => 1, PrintError => 0 } )
 >   or die $DBI::errstr;
 > 
 > 1;
 > 
 > And finally my test file:
 > 
 > #!/usr/bin/perl
 > 
 > use DBI;
 > 
 > my $dbh = DBI->connect( 'DBI:Oracle:INDICATORS', 'indic', ',
 >  { AutoCommit => 0, RaiseError => 0, PrintError => 1 } )
 >  or die $DBI::errstr;
 > 
 > $dbh->disconnect;
 > 
 > Thanks in advance
 > Jerome

-- 
David S. Kenzik
[EMAIL PROTECTED] - http://kenzik.com



Re: ORA-12154: TNS:could not resolve service name with DBI under Apache

2000-03-29 Thread Jeffrey W. Baker

On Wed, 29 Mar 2000, Jerome MOUREAUX wrote:

> Hi All,
> 
> I experience a trouble with Perl script using DBI running under Mod_perl 
> and Registry
> If you have an idea from where the problem may come
> 
> Here is the error :
> 
> DBI->connect failed: ORA-12154: TNS:could not resolve service name (DBD: 
> login f
> ailed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl line 5
> [Wed Mar 29 20:11:32 2000] [error] ORA-12154: TNS:could not resolve service 
> name
>   (DBD: login failed) at /disc1/sherpa_a/indicators2/perl/activity/toto.pl 
> line 5

> #Apache::DBI->connect_on_init("dbi:Oracle:indicators", "indic", "",
^^

> my $dbh = DBI->connect( 'DBI:Oracle:INDICATORS', 'indic', ',
  ^^


Well, which is it?  indicators or INDICATORS?  Case may be important, use
the same case as the service name definition in tnsnames.ora.

-jwb