Re: Oracle::DBD under mod_perl on Sun/Solaris

2001-08-23 Thread Alex Povolotsky

On Wed, Aug 22, 2001 at 08:33:53PM +0100, Ged Haywood wrote:
  DBD::Oracle::db prepare failed: ORA-03120: two-task conversion routine:
 [snip]
  DBD::Oracle::db prepare failed: ORA-03113: end-of-file on communication channel 
(DBD: oopen error)
  and EVERY connect to database fails since that.
  I was NOT able to reproduce this bug outside of mod_perl.
 
 Are you running out of memory?
... should not... HOWEVER, Apache::Resource, when it was installed, dropped
children on MEMORY at the time of connect to Oracle. I've set limit to 128
Mb, it didn't help.

Alex.



emboerl mod_perl apache compile

2001-08-23 Thread Jaak

Hi,

I have a compile error while compiling embperl  mod_perl.
On several machines I have succeeded, but on that machine not :-(

Maybe You can help me...

I added error messages:



[Wed Aug 22 18:09:53 2001] [error] Can't locate loadable object for module

Apache::Constants in @INC (@INC contains: /u
sr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5
.6.0 /usr/lib/perl5/site_perl . /usr/local/apache/
/usr/local/apache/lib/perl) at /usr/lib/perl5/site_perl/5.6.0/i386-l
inux/mod_perl.pm line 14
Compilation failed in require at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache.pm line 6.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache.pm line 6.
Compilation failed in require at (eval 1) line 3.

mod_perl 1.26
Embperl 1.3.3
RedHat Linux 7.0 kernel  2.4.3


apache
==
Apache/1.3.20 (Unix) mod_perl/ PHP/4.0.5 mod_ssl/2.8.4 OpenSSL/0.9.6b

perl

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.2.17-8smp, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.17-8smp #1 smp fri nov 17
16:12:17 est 2000 i686 unknown '




config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcccdlflag
s=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid
-Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3p
m -Uuselargefiles'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96
2731 (Red Hat Linux 7.1 2.96-79)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options:
  Built under linux
  Compiled at Mar 23 2001 12:49:50
  @INC:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
.


locate Constants.pm
===
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm







embedding perl code to html

2001-08-23 Thread Mike V. Andreev


Hi!

I have a tree of static html files and perl cgi-scripts. But sometimes I
want to include some simple functionality in html-file. The best
solution, I think, is including perl code to html file. I found
several tools on the Net. The best i liked is Embperl
(http://perl.apache.org/embperl/)  ePerl
(http://www.engelschall.com/sw/eperl/) . Both of them have similar
functionality. But before I make final choice i want to hear some
comments about its speed, feature, reliability etc. Or may be someone
know other tools? (I don't need very powerful thing -- main
programming will be in perl scripts anyway, so there isn't necessity
in some cool libraries and stuff )

Thanks in advance . Best regards.

-
Mike Andreev 
Programmer
SMIS Lab, Space Research Institute (Moscow, Russia). http://smis.iki.rssi.ru
[EMAIL PROTECTED]
-





Re: embedding perl code to html

2001-08-23 Thread David Young

http://perl.apache.org/features/tmpl-cmp.html

- Original Message -
From: Mike V. Andreev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 23, 2001 11:28 AM
Subject: embedding perl code to html



 Hi!

 I have a tree of static html files and perl cgi-scripts. But sometimes I
 want to include some simple functionality in html-file. The best
 solution, I think, is including perl code to html file. I found
 several tools on the Net. The best i liked is Embperl
 (http://perl.apache.org/embperl/)  ePerl
 (http://www.engelschall.com/sw/eperl/) . Both of them have similar
 functionality. But before I make final choice i want to hear some
 comments about its speed, feature, reliability etc. Or may be someone
 know other tools? (I don't need very powerful thing -- main
 programming will be in perl scripts anyway, so there isn't necessity
 in some cool libraries and stuff )

 Thanks in advance . Best regards.

 -
 Mike Andreev
 Programmer
 SMIS Lab, Space Research Institute (Moscow, Russia).
http://smis.iki.rssi.ru
 [EMAIL PROTECTED]
 -







Trouble with LWP::UserAgent respons header.

2001-08-23 Thread Erik Andersson

I am new to the LWP::UserAgent module and also in fact to object 
programming. I am currently writing a simple HTTP client.

I am using the LWP::UserAgent module and everything works fine apart from 
that I do not manage to access the headers of the respons message:

The page I access include a redirection (ie Location: http://url..).
I use the following to save down all of the respons into a file:

open (xyz,cjbfiles/file.txt);
print xyz $page-code;
print xyz $page-message;
print xyz $page-content;
close(xyz);

This works fine, all the content is included in the file together with the 
code and message.

However when I include the following
print xyz $page-headers_as_string();
what happens is that the file include the content and headers of the 
redirection page and not of the first page which included the Location: 
header.

And when I use this instead:
print xyz $page-headers;
The header show up in some hexadecimal form.

This confuses me a lot. I really want to access every available data in the 
first page which includes the Location header and NOT the content of the 
redirected page.

I use this for the actual request:
  my $page = $ua-simple_request($req);
so the agent should not proceed to the redirection page.

Can someone please help? How do I access the headers of the first page?

Erik

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




RE: Trouble with LWP::UserAgent respons header.

2001-08-23 Thread Geoffrey Young



 -Original Message-
 From: Erik Andersson [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 23, 2001 11:28 AM
 To: [EMAIL PROTECTED]
 Subject: Trouble with LWP::UserAgent respons header.
 
[snip]
 
 This confuses me a lot. I really want to access every 
 available data in the 
 first page which includes the Location header and NOT the 
 content of the 
 redirected page.
 
 I use this for the actual request:
   my $page = $ua-simple_request($req);
 so the agent should not proceed to the redirection page.
 

this is probably OT for this list, but...

see the HTTP::Response manpage, specifically

$r-previous([$previousResponse])

HTH

--Geoff



Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Vivek Khera

 PH == Perrin Harkins [EMAIL PROTECTED] writes:

PH Don't open a connection during startup.  If you do, it will be shared when
PH Apache forks, and sharing a database handle is bad for the same reasons
PH sharig a file handle is.  Open a connection in the child process instead.

Speaking of which, what does one do when Apache::DBI is loaded, and
the parent process needs to pull some config info out of the database
that all clients also use?  That is, how can I force Apache::DBI to
close that handle prior to the forking of children?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/



[PING] Testing new list memborship, please ignore

2001-08-23 Thread Rodney Broom

Thank you.

---
Rodney Broom
Programmer: Desert.Net





Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Rodney Broom

From: Benjamin Trott [EMAIL PROTECTED]


  PH Don't open a connection during startup.
  PH Open a connection in the child process instead.
 
BT  I will second this. I've done this (unintentionally) when using MySQL, and
BT  you get a lot of weird errors about statement handles being active, etc.

I haven't read the entire thread, so forgive me if I'm restating. But there are 
reasons for sharing DB connections (and reasons not to). In the case of MySQL and 
getting messages about active statement handles, that's because you're disconnecting 
the DBH. If you are in a shared connection enviroment with MySQL, you are winning. 
Since you don't have to worry about things like transactions and rolling back somebody 
elses changes. All you need to do is finish() your statement handled when you are 
finished with them:

  $sth-finish;

This will prevent the errors you are seeing and will allow you to keep the shared DB 
connection. A shared connection is usefull for efficiency, since creating a connection 
may be expensive.


From: Rasoul Hajikhani [EMAIL PROTECTED]
 I am sorry but this topic is confusing me... Are you saying that
 persistent DB connection objects are bad?

It sounds like that, doesn't it?


 I am about to switch to Apache::DBI for that very reason. I don't
 want to create a new db handle with every request. Should I stop,
 or am I missing something here?

Nope, you've got it. If you don't have transactions (anything else?) to worry about, 
I'd say to use Apache::DBI. Remember, from the Apache::DBI docs:

Do NOT change anything in your scripts. The usage of this
module is absolutely transparent !

---
Rodney Broom
Programmer: Desert.Net






Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread darren chamberlain

Rodney Broom [EMAIL PROTECTED] said something to this effect on 08/23/2001:
 From: Rasoul Hajikhani [EMAIL PROTECTED]
  I am sorry but this topic is confusing me... Are you saying that
  persistent DB connection objects are bad?
 
 It sounds like that, doesn't it?

This is only when one handle is shared among many children.
Sharing an open handle in the same child (i.e., by successive
requests) is what you want to achieve.  Since each child services
requests serially, each handle is being used onlt once at a time,
but the handle does not disconnect at the end of the request.

(darren)

-- 
Occam's Razor:
The explanation requiring the fewest assumptions is probably the
correct one.



Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Benjamin Trott

 PH Don't open a connection during startup.
 PH Open a connection in the child process instead.
 
 BT  I will second this. I've done this (unintentionally) when using MySQL,
 and
 BT  you get a lot of weird errors about statement handles being active, etc.
 
 I haven't read the entire thread, so forgive me if I'm restating. But there
 are reasons for sharing DB connections (and reasons not to). In the case of
 MySQL and getting messages about active statement handles, that's because
 you're disconnecting the DBH. If you are in a shared connection enviroment
 with MySQL, you are winning. Since you don't have to worry about things like
 transactions and rolling back somebody elses changes. All you need to do is
 finish() your statement handled when you are finished with them:
 
 $sth-finish;
 
 This will prevent the errors you are seeing and will allow you to keep the
 shared DB connection. A shared connection is usefull for efficiency, since
 creating a connection may be expensive.

No, I called finish on all of my statement handles; that is not the reason
for the errors I got. The behavior I am talking about *only occurs* for me
when I open a connection in the Apache parent. Then this same DB connection
is shared across all of the Apache children, and Strange Things occur.

 I am sorry but this topic is confusing me... Are you saying that
 persistent DB connection objects are bad?
 
 It sounds like that, doesn't it?

Well, I'm sorry if it sounds like that, but that's not what I'm saying. :)

I am merely echoing Perrin's statement that opening a shared connection in
the parent is bad, because this connection is then shared between *all* of
the children. You don't want this. You want one connection per child, not
one connection shared between all Apache children. The latter *will* cause
problems.

 I am about to switch to Apache::DBI for that very reason. I don't
 want to create a new db handle with every request. Should I stop,
 or am I missing something here?
 
 Nope, you've got it. If you don't have transactions (anything else?) to worry
 about, I'd say to use Apache::DBI.

I would absolutely encourage anyone to use Apache::DBI.

The case I am talking about is a very particular one: when you open a shared
connection in the parent. You don't want this connection to be an
Apache::DBI connection, so instead you should use the magic 6th arg to
DBI::connect to force DBI to handle it exclusively.

bye,
Ben




Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Perrin Harkins

 Nope, you've got it. If you don't have transactions (anything else?) to
worry about, I'd say to use
 Apache::DBI.

Apache::DBI doesn't have a problem with transactions.  If you're doing
strange things like changing isolation levels on particular requests you can
get into trouble, but that's an unusual case and you can always write your
own cleanup code for it.
- Perrin




PerlModule Error

2001-08-23 Thread Rasoul Hajikhani

I know this question will sound primitive to most of you, however, I
have this nagging error which won't go away. 
In my httpsd.conf, I have declared PerlModule
MY::Perl::Control::WebAccess which I know is where it is supposed to
be. My @INC does not include the path to that directory, however, in my
startup.pl I have that directory as my 
use lib qw(...);. I have tried declaring:
use MY::Perl::Control::WebAccess; in my startup.pl, with the same
result: apache won't start. 
I mean what's up? I have another module sitting next to my
MY::Perl::Control::WebAccess and in my startup.pl I have:
use MY::Perl::Control::Cookie_Check; and all is fine and dandy...
apache runs without a hitch. I tried perl5lib (all capital) in my
.cshrc, again nothing. Now I come to you learned people in the hope of
salvation... Any ideas people?
-r



Re: PerlModule Error

2001-08-23 Thread ___cliff rayman___

and what do the error logs say?

Rasoul Hajikhani wrote:

 I know this question will sound primitive to most of you, however, I
 have this nagging error which won't go away.
 In my httpsd.conf, I have declared PerlModule
 MY::Perl::Control::WebAccess which I know is where it is supposed to
 be. My @INC does not include the path to that directory, however, in my
 startup.pl I have that directory as my
 use lib qw(...);. I have tried declaring:
 use MY::Perl::Control::WebAccess; in my startup.pl, with the same
 result: apache won't start.
 I mean what's up? I have another module sitting next to my
 MY::Perl::Control::WebAccess and in my startup.pl I have:
 use MY::Perl::Control::Cookie_Check; and all is fine and dandy...
 apache runs without a hitch. I tried perl5lib (all capital) in my
 .cshrc, again nothing. Now I come to you learned people in the hope of
 salvation... Any ideas people?
 -r

--
___cliff [EMAIL PROTECTED]http://www.genwax.com/





Re: PerlModule Error

2001-08-23 Thread Rasoul Hajikhani

___cliff rayman___ wrote:
 
 and what do the error logs say?
 
 Rasoul Hajikhani wrote:
 
  I know this question will sound primitive to most of you, however, I
  have this nagging error which won't go away.
  In my httpsd.conf, I have declared PerlModule
  MY::Perl::Control::WebAccess which I know is where it is supposed to
  be. My @INC does not include the path to that directory, however, in my
  startup.pl I have that directory as my
  use lib qw(...);. I have tried declaring:
  use MY::Perl::Control::WebAccess; in my startup.pl, with the same
  result: apache won't start.
  I mean what's up? I have another module sitting next to my
  MY::Perl::Control::WebAccess and in my startup.pl I have:
  use MY::Perl::Control::Cookie_Check; and all is fine and dandy...
  apache runs without a hitch. I tried perl5lib (all capital) in my
  .cshrc, again nothing. Now I come to you learned people in the hope of
  salvation... Any ideas people?
  -r
 
 --
 ___cliff [EMAIL PROTECTED]http://www.genwax.com/

Here it is:

Undefined subroutine My::Perl::Control::WebAccess::handler called.

-r



getting a normal html-page

2001-08-23 Thread allan

i have finally installed mod_perl (on mac osX)

i can telnet to the sever
and the error_log says:
[Fri Aug 24 00:53:40 2001] [notice] Apache/1.3.20 (Darwin) mod_perl/1.25
configured -- resuming normal operations

so im quite sure im pretty close ...

my first major problem now is that i get a normal html page from the browser.

the url http://127.0.0.1 should just show the apache server default page
but in my browser it never even gets a connection (it times out).

my webserver document root is configured to /usr/local/apache/htdocs

how come i cant even get a straigt html-page?

thnaks
allan



Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Rodney Broom

From: Perrin Harkins [EMAIL PROTECTED]

 Apache::DBI doesn't have a problem with transactions.

Ah, OK. What about when a shared connection is rolled back in one process, will it 
effect other running processes with the same handle?


---
Rodney Broom
Programmer: Desert.Net






Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Perrin Harkins

 Apache::DBI doesn't have a problem with transactions.

 Ah, OK. What about when a shared connection is rolled back in one process,
 will it effect other running processes with the same handle?

Database handles are never shared between processes.  If you missed this,
you should re-read the Apache::DBI docs.
- Perrin






[OT] Redirect w/ Netscape browser causing 'Document contains no data'

2001-08-23 Thread Daniel Little

I seem to have a strange problem here with Netscape displaying the error
'Document contains no data' when I do $Response-Redirect($location). 

I'm using Apache 1.3.19, mod_perl 1.25, Apache::ASP v2.09, but I don't think
it's in Apache::ASP, as the redirect code in there looks pretty much the
same as what is recommended in the guide. We have a front-end proxy
configuration that also has mod_proxy_add_forward installed, but that was
only added recently and I've been trying to track this problem down for a
little while.

Looking at the logs, both the frontend and backend servers are logging a
status code of '302', with '0' bytes transferred - just like I would expect
it to. If I go directly to the backend server, it makes no difference,
either. It also doesn't seem to make any difference if I buffer output or
not. All of this, of course, works just fine in IE. 

I've got a work-around (ugly) by putting META HTTP-EQUIV=refresh
CONTENT=0 ;URL=$location but I'd really like to get rid of that. 

Anybody have any ideas?

Daniel.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Daniel Little  Metrex Systems Inc.[EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Re: PerlModule Error

2001-08-23 Thread Stas Bekman

On Thu, 23 Aug 2001, Rasoul Hajikhani wrote:

 ___cliff rayman___ wrote:
 
  and what do the error logs say?
 
  Rasoul Hajikhani wrote:
 
   I know this question will sound primitive to most of you, however, I
   have this nagging error which won't go away.
   In my httpsd.conf, I have declared PerlModule
   MY::Perl::Control::WebAccess which I know is where it is supposed to
   be. My @INC does not include the path to that directory, however, in my
   startup.pl I have that directory as my
   use lib qw(...);. I have tried declaring:
   use MY::Perl::Control::WebAccess; in my startup.pl, with the same
   result: apache won't start.
   I mean what's up? I have another module sitting next to my
   MY::Perl::Control::WebAccess and in my startup.pl I have:
   use MY::Perl::Control::Cookie_Check; and all is fine and dandy...
   apache runs without a hitch. I tried perl5lib (all capital) in my
   .cshrc, again nothing. Now I come to you learned people in the hope of
   salvation... Any ideas people?
   -r
 
  --
  ___cliff [EMAIL PROTECTED]http://www.genwax.com/

 Here it is:

 Undefined subroutine My::Perl::Control::WebAccess::handler called.

That's not the error that we want to see. The error you've listed can
happen when you actually generate some request. But that's after Apache
has started. PerlModule on the other hand merely loads the file similar to
use. As you say use() doesn't work for you too. Are you sure you can
perform:

% perl -c MY/Perl/Control/WebAccess.pm

remove the error_log file before you start a new test and see what
happens.

If you still fail to find the problem. Take your code and shrink it to
smallest possible size, while it still imposes a problem for you and
together with the configuration section for this module send it to the
list. Remember, we want a simple test that we can easily understand and
reproduce the problem with.

Thanks.

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://localhost/  http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: PerlModule Error

2001-08-23 Thread Ken Williams

[EMAIL PROTECTED] (Rasoul Hajikhani) wrote:
  use lib qw(...);. I have tried declaring:
  use MY::Perl::Control::WebAccess; in my startup.pl, with the same

Here it is:

Undefined subroutine My::Perl::Control::WebAccess::handler called.

Looks like you need to check the capitalization on 'MY'.

By the way, using the MY:: namespace isn't the greatest idea in the
first place, because the MY:: namespace is used by MakeMaker during
modules' installation process.  I'm sure it's not causing a problem
here, but it can at least create confusion in the mind.


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum



Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Benjamin Trott

 PH Don't open a connection during startup.  If you do, it will be shared when
 PH Apache forks, and sharing a database handle is bad for the same reasons
 PH sharig a file handle is.  Open a connection in the child process instead.

I will second this. I've done this (unintentionally) when using MySQL, and
you get a lot of weird errors about statement handles being active, etc.

 Speaking of which, what does one do when Apache::DBI is loaded, and
 the parent process needs to pull some config info out of the database
 that all clients also use?  That is, how can I force Apache::DBI to
 close that handle prior to the forking of children?

By using the magic 6th arg ($connect_meth in the DBI::connect source) to
DBI::connect. In my DB wrapper I have a connect method that internally calls
DBI::connect; before doing so, it checks to see if it is being called while
Apache is starting up in the parent process, and if so, it uses this special
arg.

my @args = (dbi:$db-{driver}:$dbname, $user, $pass,
   { RaiseError = 1 });
push @args, (undef, 'connect')
if $Apache::Server::Starting or $Visius::httpd_conf::Loading;

$self-{handle} = DBI-connect(@args);

The 'connect' is that magic argument that forces DBI to use its standard
connect method, rather than Apache::DBI::connect, when creating the new db
handle. This means that it is essentially a use-once DB handle, and that it
will not be reused by Apache::DBI.

Does this help?

bye,
Ben




Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Rasoul Hajikhani

Benjamin Trott wrote:
 
  PH Don't open a connection during startup.  If you do, it will be shared when
  PH Apache forks, and sharing a database handle is bad for the same reasons
  PH sharig a file handle is.  Open a connection in the child process instead.
 
 I will second this. I've done this (unintentionally) when using MySQL, and
 you get a lot of weird errors about statement handles being active, etc.
 
  Speaking of which, what does one do when Apache::DBI is loaded, and
  the parent process needs to pull some config info out of the database
  that all clients also use?  That is, how can I force Apache::DBI to
  close that handle prior to the forking of children?
 
 By using the magic 6th arg ($connect_meth in the DBI::connect source) to
 DBI::connect. In my DB wrapper I have a connect method that internally calls
 DBI::connect; before doing so, it checks to see if it is being called while
 Apache is starting up in the parent process, and if so, it uses this special
 arg.
 
 my @args = (dbi:$db-{driver}:$dbname, $user, $pass,
{ RaiseError = 1 });
 push @args, (undef, 'connect')
 if $Apache::Server::Starting or $Visius::httpd_conf::Loading;
 
 $self-{handle} = DBI-connect(@args);
 
 The 'connect' is that magic argument that forces DBI to use its standard
 connect method, rather than Apache::DBI::connect, when creating the new db
 handle. This means that it is essentially a use-once DB handle, and that it
 will not be reused by Apache::DBI.
 
 Does this help?
 
 bye,
 Ben

I am sorry but this topic is confusing me... Are you saying that
persistent DB connection objects are bad? I am about to switch to
Apache::DBI for that very reason. I don't want to create a new db handle
with every request. Should I stop, or am I missing something here?
RFC 
-r



Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Vivek Khera

 BT == Benjamin Trott [EMAIL PROTECTED] writes:

 that all clients also use?  That is, how can I force Apache::DBI to
 close that handle prior to the forking of children?

BT By using the magic 6th arg ($connect_meth in the DBI::connect source) to
BT DBI::connect. In my DB wrapper I have a connect method that internally calls

Duh... the source!  What a concept ;-)

Looking at Apache::DBI::connect, it special cases startup connections,
so it just works automagically.  How 'bout that!

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/



RE: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Kyle Oppenheim

We've seen this happen before.  Unfortunately, I don't have a fix for you
but I here's where we left off our chase...

1. ORA-03113: end-of-file on communication channel (for unknown reason,
maybe a network blip?)

2. We have some code that will catch this error and call DBI-connect again.

3. Apache::DBI intercepts the connect(), looks in it's hash and sees that it
already has a connection.  It pings the handle, fails, and deletes the entry
from the hash.  That's the last refcount on the dbh, so DESTROY gets called.

4. The DESTROY method yields a DBI handle cleared whilst still active
warning..

  Issuing rollback() for database handle being DESTROY'd without explicit
  disconnect() at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line
119.
  DBI handle cleared whilst still active
  at /usr/local/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 119.
  dbih_clearcom (h 0x82a3934, com 0x84ae49c):
 FLAGS 0x211: COMSET Warn AutoCommit
 TYPE 1
 PARENT undef
 KIDS 0 (0 active)
 IMP_DATA undef in 'DBD::Oracle::dr'

5. Apache::DBI calls the real DBI-connect.  This fails due to a ORA-12154:
TNS:could not resolve service name (DBD ERROR: OCIServerAttach).


If we run with DBI-trace(2) and $Apache::DBI::Debug = 2, we see ORA-01041:
internal error. hostdef extension doesn't exist (DBD ERROR:
OCITransRollback) appear in between the ORA-03113 and the ORA-12154 errors.

We were running Perl 5.6.0, DBI 1.14, Apache::DBI 0.88, DBD::Oracle 1.06,
and the Oracle 8.06 client against an 8.0.6.3.0 db.

Make sure you let me know if you figure it out ;-)

- Kyle

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of
 Alex Povolotsky
 Sent: Wednesday, August 22, 2001 4:59 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Problem with DBD::Oracle with mod_perl


 Hello!

 I'm getting constant troubles with DBD::Oracle and mod_perl.

 DBD::Oracle 1.08, DBI 1.19, mod_perl 1.26 on Apache 1.3.20,
 SunOS netra 5.8 Generic_108528-09 sun4u sparc SUNW,UltraAX-i2
 gcc 2.95.3 20010315 (release)
 This is perl, v5.6.1 built for sun4-solaris
 # perl -V:usemymalloc
 usemymalloc='n';


 After some time of work (about hundred of requests), I get

 DBD::Oracle::db prepare failed: ORA-03113: end-of-file on communication
 channel
 (DBD: error possibly near * indicator at char 1 in '*select
 slogan_text
 from
  slogans') at /usr/local/www/lib/SQL.pm line 221.

 and all Oracle-using perl programs within Apache stops to work until I
 restart Apache.

 With two clients fetching a page both at one time, I'm 100%
 getting this in
 less than a minute.

 I have read all READMEs I've found around, and I couldn't reproduce this
 error by standalone perl scripts.

 Any help, anyone?

 Alex.





Re: Problem with DBD::Oracle with mod_perl

2001-08-23 Thread Tim Bunce

On Thu, Aug 23, 2001 at 11:19:22AM -0700, Kyle Oppenheim wrote:

 3. Apache::DBI intercepts the connect(), looks in it's hash and sees that it
 already has a connection.  It pings the handle, fails, and deletes the entry
 from the hash.  That's the last refcount on the dbh, so DESTROY gets called.

 4. The DESTROY method yields a DBI handle cleared whilst still active warning..

Apache::DBI should probably do an explicit eval { $dbh-disconnect } if the ping fails.

Tim.