Hi Stas,

> Can you please try to convert the script into a mod_perl handler and
> test again?

OK, I just checked it.
The result was everything fine using by mod_perl handler!
There was no problem in my new code.

...But I want to use ModPerl::Registry, because this is easy to migrate from
normal CGI script.
Please investigate the reason.

Thank you very much.

Atsushi

PS: I attach my conf and code using by mod_perl handler.

----[/conf/httpd.conf]----
<IfModule mod_perl.c>
    PerlRequire "/yopt/httpd-2.0.39_prefork_perl5.6.1normal/conf/startup.pl"

    # Perl module Auto-Reloading
    PerlModule Apache::Reload
    PerlInitHandler Apache::Reload
    PerlSetVar ReloadAll Off
    PerlSetVar ReloadModules "MyApache::* ModPerl::* Apache::*"

    PerlModule MyApache::test3
    <Location /MyApache/test3>
        SetHandler modperl
        PerlResponseHandler MyApache::test3
    </Location>
</IfModule>
--------


----[/conf/startup.pl]----
use Apache2 ();

use lib qw(/yopt/httpd-2.0.39_prefork_perl5.6.1normal/cgi-bin);

# enable if the mod_perl 1.0 compatibility is needed
# use Apache::compat ();

use ModPerl::Util (); #for CORE::GLOBAL::exit

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();

use APR::Table ();

use ModPerl::Registry ();

use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';

1;
--------


----[/cgi-bin/MyApache/test3.pm]----
package MyApache::test3;

use strict;

use Apache::Const -compile => qw(OK);

use DBI;

sub handler {
 my $r = shift;

 my $dsn      = 'dbi:Oracle:';
 my $user     = 'username/password';
 my $password = '';

 my $dbh;
 my $sth;

 my $sql = "select SEQUENCE_OWNER, SEQUENCE_NAME, LAST_NUMBER from
ALL_SEQUENCES";

 my $rv;
 my @row;

 $r->content_type('text/html');

 $ENV{'ORACLE_HOME'} = '/u01/app/oracle/product/9.0.1';
 $ENV{'ORACLE_SID'}  = 'ynt0';
 $ENV{'NLS_LANG'}    = 'japanese_japan.ja16euc';

 $r->print("Now is: " . scalar(localtime) . "<br>\n");

 $r->print("ORACLE_HOME=$ENV{'ORACLE_HOME'}<br>\n");
 $r->print("ORACLE_SID=$ENV{'ORACLE_SID'}<br>\n");
 $r->print("NLS_LANG=$ENV{'NLS_LANG'}<br>\n");
 $r->print("DSN=$dsn$ENV{'ORACLE_SID'}<br>\n");

 $dbh = DBI->connect("$dsn$ENV{'ORACLE_SID'}", $user, $password)
  or die "Cannot connect: ".$DBI::errstr;

 $sth = $dbh->prepare($sql)
  or die "Cannot prepare: ".$dbh->errstr();

 $rv = $sth->execute
  or die "Cannot execute: ".$sth->errstr();

 $r->print("sth=[$sth],rv=[$rv]<br>\n");

 while(@row = $sth->fetchrow_array){
  $r->print("@row<br>\n");
 }

 $sth->finish();
 $dbh->disconnect();

 $r->print("<br>Finished!!<br>\n");

 return Apache::OK;
}
1;
--------



----- Original Message -----
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Atsushi Fujita" <[EMAIL PROTECTED]>
Cc: "Lyle Brooks" <[EMAIL PROTECTED]>; "Fredo Sartori"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 16, 2002 11:42 AM
Subject: Re: apache2, DBD/Oracle problem


> Atsushi Fujita wrote:
> > Hi Lyle,
> >
> >
> >>I does seem to be an ORACLE environment issue.
>
> Can you please try to convert the script into a mod_perl handler and
> test again? I doubt this is registry problem, but probably something
> that about setting up the env for mod_perl in general.
>
> What would help most is to write a test that exposes this problem. I
> don't have Oracle, so if you could help me reproduce the problem, I'd
> know what to fix.
>
> Thanks!
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>

Reply via email to