Another Apache::DBI problem

2001-09-06 Thread Mauricio Herrera

Hi!

I'm running modperl 1.26 and apache 1.3.20 on a Solaris machine. I added
Apache::DBI and other DBI modules.

I added the following line to the httpd.conf line to use Apache::DBI

PerlModule Apache::DBI

Before any other DBI command as stated on the docs. Here's the error I get
at starting apache:

Syntax error on line 304 of /export/apache/conf/httpd.conf:
Can't load
'/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so' for
module DBI: ld.so.1: /export/apache/bin/httpd: fatal: relocation error:
file /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so:
symbol main: referenced symbol not found at
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
 at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189.
Compilation failed in require at
/usr/local/lib/perl5/site_perl/5.6.1/Apache/DBI.pm line 4.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.6.1/Apache/DBI.pm line 4.
Compilation failed in require at (eval 4) line 3.

Line 304 of httpd.conf is the PerlModule Apache::DBI command.

Any ideas? 

Thanks for your help!

Mauricio




Re: Another Apache::DBI problem

2001-09-06 Thread Perrin Harkins

 Syntax error on line 304 of /export/apache/conf/httpd.conf:
 Can't load
 '/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so' for
 module DBI: ld.so.1: /export/apache/bin/httpd: fatal: relocation error:
 file /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so:
 symbol main: referenced symbol not found at
 /usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
  at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189
 BEGIN failed--compilation aborted at
 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189.
 Compilation failed in require at
 /usr/local/lib/perl5/site_perl/5.6.1/Apache/DBI.pm line 4.
 BEGIN failed--compilation aborted at
 /usr/local/lib/perl5/site_perl/5.6.1/Apache/DBI.pm line 4.
 Compilation failed in require at (eval 4) line 3.

 Line 304 of httpd.conf is the PerlModule Apache::DBI command.

 Any ideas?

This looks like a DBI installation problem, not an Apache::DBI problem.
Does DBI work when you don't use Apache::DBI?
- Perrin




Re: Another Apache::DBI problem

2001-09-06 Thread Mauricio Herrera

This looks like a DBI installation problem, not an Apache::DBI problem.
Does DBI work when you don't use Apache::DBI?
- Perrin

You are right. It gives me the same error when I try to use DBI alone:

[error] Can't load
'/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so' for
module DBI: ld.so.1: /export/apache/bin/httpd: fatal: relocation error:
file /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so:
symbol main: referenced symbol not found at
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
 at /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 189.
Compilation failed in require at /export/www/perl/dbi.html line 1.
BEGIN failed--compilation aborted at /export/www/perl/dbi.html line 1.


The DBI installation went fine, I used CPAN. DBI version is 1.20. I looked
for the DBI.so and the DBI.pm files and they are in the correct paths. 

What may be the problem?

Thanks!

Mauricio




Re: Another Apache::DBI problem

2001-09-06 Thread Perrin Harkins

 The DBI installation went fine, I used CPAN. DBI version is 1.20. I looked
 for the DBI.so and the DBI.pm files and they are in the correct paths.

 What may be the problem?

I don't know, but you might have more luck asking about it on the DBI list.
Or you could do some searching on Google for similar error messages.
- Perrin




Re: DBI Problem...

2001-08-13 Thread Thomas Eibner

On Mon, Aug 13, 2001 at 03:33:18PM -, qazi Ahmed wrote:
 Hi DBI Gurus,

Even though many lurk here too, you're on the wrong list for DBI help.

 I have DBD, DBI, Apache::DBI installed in my machine.
 Actually when i try to access the database i am getting the following error.

Try DBI users mailinglist: [EMAIL PROTECTED]

-- 
  Thomas Eibner http://thomas.eibner.dk/ DnsZone http://dnszone.org/
  mod_pointer http://stderr.net/mod_pointer 




Re: mod_perl/DBI problem

2001-07-31 Thread Curtis Hawthorne

Even when using Apache::DBI, I still have the same problem - If it times out
once, it won't try again.  I set Apache::DBI::DEBUG = 2, and here's the log:

When I first load the page and get the timeout:

197345 Apache::DBI need ping: yes
197345 Apache::DBI new connect to
'DatabaseusernamepasswordPrintError=1RaiseError=1AutoCommit=1'
[Tue Jul 31 09:31:45 2001] [error] DBI-connect(Database) failed:
[Microsoft][ODBC SQL Server Driver]Timeout expired (SQL-S1T00)(DBD:
db_login/SQLConnect err=-1) at DatabaseStuff.pm line 32
Compilation failed in require at (eval 8) line 9.
BEGIN failed--compilation aborted at (eval 8) line 9.

Try to reload the page:
[Tue Jul 31 09:33:11 2001] [error] Can't call method quote on an undefined
value at DatabaseStuff.pm line 660.

Try again:
[Tue Jul 31 09:33:14 2001] [error] Can't call method quote on an undefined
value at DatabaseStuff.pm line 660.

And so on.  The only thing that seems to fix it is restarting the server,
which by the way is Apache/1.3.20 (Win32) with mod_perl/1.26_01-dev.
Apache::DBI is version 0.87, DBD::ODBC (which I use for my database
connections) is version 0.28.

Any ideas?

Curtis H.

- Original Message -
From: Ged Haywood [EMAIL PROTECTED]
To: Curtis Hawthorne [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, July 27, 2001 4:19 PM
Subject: Re: mod_perl/DBI problem


 Hi there,

 On Fri, 27 Jul 2001, Curtis Hawthorne wrote:

  So, how can I have it try to connect to the database again if it fails,
but
  keep the connection persistent if it doesn't?

 Have a look in the Guide, there's lots of stuff in there about
 Apache::DBI.  http://perl.apache.org/guide.

 73,
 Ged.







RE: mod_perl/DBI problem

2001-07-31 Thread Geoffrey Young



 -Original Message-
 From: Curtis Hawthorne [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 31, 2001 10:47 AM
 To: [EMAIL PROTECTED]
 Subject: Re: mod_perl/DBI problem
 
 
 Even when using Apache::DBI, I still have the same problem - 
 If it times out
 once, it won't try again.  I set Apache::DBI::DEBUG = 2, and 
 here's the log:
 
 When I first load the page and get the timeout:
 
 197345 Apache::DBI need ping: yes
 197345 Apache::DBI new connect to
 'DatabaseusernamepasswordPrintError=1RaiseError=1AutoCommit=1'
 [Tue Jul 31 09:31:45 2001] [error] DBI-connect(Database) failed:
 [Microsoft][ODBC SQL Server Driver]Timeout expired (SQL-S1T00)(DBD:
 db_login/SQLConnect err=-1) at DatabaseStuff.pm line 32
 Compilation failed in require at (eval 8) line 9.
 BEGIN failed--compilation aborted at (eval 8) line 9.
 

the way most people handle this is by separating out the connect routine,
wrapping it in an eval, and calling $r-child_terminate if $dbh is undef.
It's not ideal, but it takes that child out of the pool instead of having it
lingering with a bad connection for the next 5000 requests (or whatever your
MaxRequestPerChild is).

this is what I use for Oracle:

  eval {
$dbh = DBI-connect($dbase, $user, $pass,
  {RaiseError = 1, AutoCommit = 1, PrintError = 1});
  };

  if ($@) {
# if we could not log in, then there is the possibility under
# Apache::DBI that the child may never recover...
$r-server-log_error(Doh! We may have a TNS error: $DBI::errstr ,
  Scheduling child $$ termination NOW...);
$r-child_terminate;
  }

HTH

--Geoff



Re: mod_perl/DBI problem

2001-07-31 Thread Curtis Hawthorne

That looks like that will do exactly what I need.  I tried it my code and it
caught the server timeout and wrote an error to the log file using
$r-server-log_error, but when I try to do $r-child_terminate, I get this
error:

[Tue Jul 31 11:16:35 2001] [error] Can't locate object method
child_terminate
via package Apache (perhaps you forgot to load Apache?) at
DatabaseStuff.pm line 56.

But I have loaded Apache.  Would my running Apache in a win32 environment
(which uses threads instead of processes) have anything to do with that?

Curtis H.

- Original Message -
From: Geoffrey Young [EMAIL PROTECTED]
To: 'Curtis Hawthorne' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 31, 2001 10:04 AM
Subject: RE: mod_perl/DBI problem


snip

 the way most people handle this is by separating out the connect routine,
 wrapping it in an eval, and calling $r-child_terminate if $dbh is undef.
 It's not ideal, but it takes that child out of the pool instead of having
it
 lingering with a bad connection for the next 5000 requests (or whatever
your
 MaxRequestPerChild is).

 this is what I use for Oracle:

   eval {
 $dbh = DBI-connect($dbase, $user, $pass,
   {RaiseError = 1, AutoCommit = 1, PrintError = 1});
   };

   if ($@) {
 # if we could not log in, then there is the possibility under
 # Apache::DBI that the child may never recover...
 $r-server-log_error(Doh! We may have a TNS error: $DBI::errstr ,
   Scheduling child $$ termination NOW...);
 $r-child_terminate;
   }

 HTH

 --Geoff





RE: mod_perl/DBI problem

2001-07-31 Thread Geoffrey Young



 -Original Message-
 From: Curtis Hawthorne [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 31, 2001 12:24 PM
 To: [EMAIL PROTECTED]
 Subject: Re: mod_perl/DBI problem
 
 
 That looks like that will do exactly what I need.  I tried it 
 my code and it
 caught the server timeout and wrote an error to the log file using
 $r-server-log_error, but when I try to do 
 $r-child_terminate, I get this
 error:
 
 [Tue Jul 31 11:16:35 2001] [error] Can't locate object method
 child_terminate
 via package Apache (perhaps you forgot to load Apache?) at
 DatabaseStuff.pm line 56.
 
 But I have loaded Apache.  Would my running Apache in a win32 
 environment
 (which uses threads instead of processes) have anything to do 
 with that?

yup, looks like mod_perl doesn't offer that to windows.

well, I don't do windows, but maybe something like this would work...

call $dbh-all_handlers, which should return a reference to %Connected.  my
thought is that since windows has only one process, that %Connected will
only contain a single entry.  removing that entry should have the desired
effect...

completely untested and theoretical...

--Geoff



RE: mod_perl/DBI problem

2001-07-31 Thread Geoffrey Young



 -Original Message-
 From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 31, 2001 12:46 PM
 To: 'Curtis Hawthorne'; [EMAIL PROTECTED]
 Subject: RE: mod_perl/DBI problem

 
 yup, looks like mod_perl doesn't offer that to windows.
 
 well, I don't do windows, but maybe something like this would work...
 
 call $dbh-all_handlers, which should return a reference to 
 %Connected.  my
 thought is that since windows has only one process, that 
 %Connected will
 only contain a single entry.  removing that entry should have 
 the desired
 effect...

well, I can see the flaw in this already - it won't work if you connect to
more than one database, using more than one userid, etc.

but for a single connection it may work ok, otherwise you would have to
follow the algorithm in Apache::DBI to get the $Idx for your connection and
delete that key...

anyway, HTH

--Geoff



Re: mod_perl/DBI problem

2001-07-31 Thread Curtis Hawthorne

Well, that works perfectly, but doesn't do anything :-).

As far as I can tell, because my database connection code is at the top of
my module that the CGI script uses, the code is only run the first time that
the script runs.  If the connection times out and is caught by the eval code
you suggested below, the script writes an error to the log but is still
running because I apparently don't have $r-terminate_child.  The next time
the script runs, it has already evaluated all the code in the module, so it
doesn't try to connect to the database again, and doesn't consult the
%Connected hash and doesn't realize that it doesn't have a connection.  My
script merrily goes on its way calling subs in the module and quickly errors
out.

Pseudo code of my module:
eval {
connect_to_database;
};

if($@) {
writeerror;
clear(%Connected);
}

sub dostuff {
return manipulatedatabase;
}

sub dothings {
return querydatabase;
}

So, should I rewrite it so that it makes a new connection (but not really
because of Apache::DBI) in each sub, or have the script call a subroutine
that gives it a database handle to pass to each sub, go at it a completely
different way, or am I way off in my analysis of the problem?

Really confused,

Curtis H.

- Original Message -
From: Geoffrey Young [EMAIL PROTECTED]
To: 'Curtis Hawthorne' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 31, 2001 11:49 AM
Subject: RE: mod_perl/DBI problem




  -Original Message-
  From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, July 31, 2001 12:46 PM
  To: 'Curtis Hawthorne'; [EMAIL PROTECTED]
  Subject: RE: mod_perl/DBI problem

 
  yup, looks like mod_perl doesn't offer that to windows.
 
  well, I don't do windows, but maybe something like this would work...
 
  call $dbh-all_handlers, which should return a reference to
  %Connected.  my
  thought is that since windows has only one process, that
  %Connected will
  only contain a single entry.  removing that entry should have
  the desired
  effect...

 well, I can see the flaw in this already - it won't work if you connect to
 more than one database, using more than one userid, etc.

 but for a single connection it may work ok, otherwise you would have to
 follow the algorithm in Apache::DBI to get the $Idx for your connection
and
 delete that key...

 anyway, HTH

 --Geoff





RE: mod_perl/DBI problem

2001-07-31 Thread Geoffrey Young



 -Original Message-
 From: Curtis Hawthorne [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 31, 2001 3:48 PM
 To: Geoffrey Young; [EMAIL PROTECTED]
 Subject: Re: mod_perl/DBI problem
 
 
 Well, that works perfectly, but doesn't do anything :-).
 
 As far as I can tell, because my database connection code is 
 at the top of
 my module that the CGI script uses, the code is only run the 
 first time that
 the script runs.  If the connection times out and is caught 
 by the eval code
 you suggested below, the script writes an error to the log 
 but is still
 running because I apparently don't have $r-terminate_child.  
 The next time
 the script runs, it has already evaluated all the code in the 
 module, so it
 doesn't try to connect to the database again, and doesn't consult the
 %Connected hash and doesn't realize that it doesn't have a 
 connection.  My
 script merrily goes on its way calling subs in the module and 
 quickly errors
 out.

hmph, it's been a while since I've done any Registry.pm work...

basically, all my stuff is OO now, so I use a method handler that inherits
from a base Util class and call
my $dbh = $self-connect;
where Util::connect() contains the eval() construct.  that works like a
charm.  

I don't understand why the eval() isn't working as it should, but maybe its
a windows thing or maybe I'm missing something - using eval() as an
exception handling mechansim ought to execute the code every time,
regardless of whether perl has seen it already.  perhaps its a nested eval()
thing...

at any rate, your suggestions below are good ones to follow - I think you're
on the right path.  try creating a util package, or at least a subroutine
within your script that contains the eval() and passes $dbh back to you and
see if that helps.  almost there :)

--Geoff

 
 Pseudo code of my module:
 eval {
 connect_to_database;
 };
 
 if($@) {
 writeerror;
 clear(%Connected);
 }
 
 sub dostuff {
 return manipulatedatabase;
 }
 
 sub dothings {
 return querydatabase;
 }
 
 So, should I rewrite it so that it makes a new connection 
 (but not really
 because of Apache::DBI) in each sub, or have the script call 
 a subroutine
 that gives it a database handle to pass to each sub, go at it 
 a completely
 different way, or am I way off in my analysis of the problem?
 
 Really confused,
 
 Curtis H.
 
 - Original Message -
 From: Geoffrey Young [EMAIL PROTECTED]
 To: 'Curtis Hawthorne' [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]
 Sent: Tuesday, July 31, 2001 11:49 AM
 Subject: RE: mod_perl/DBI problem
 
 
 
 
   -Original Message-
   From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, July 31, 2001 12:46 PM
   To: 'Curtis Hawthorne'; [EMAIL PROTECTED]
   Subject: RE: mod_perl/DBI problem
 
  
   yup, looks like mod_perl doesn't offer that to windows.
  
   well, I don't do windows, but maybe something like this 
 would work...
  
   call $dbh-all_handlers, which should return a reference to
   %Connected.  my
   thought is that since windows has only one process, that
   %Connected will
   only contain a single entry.  removing that entry should have
   the desired
   effect...
 
  well, I can see the flaw in this already - it won't work if 
 you connect to
  more than one database, using more than one userid, etc.
 
  but for a single connection it may work ok, otherwise you 
 would have to
  follow the algorithm in Apache::DBI to get the $Idx for 
 your connection
 and
  delete that key...
 
  anyway, HTH
 
  --Geoff
 
 



Re: mod_perl/DBI problem

2001-07-31 Thread Curtis Hawthorne

Well, I think the eval is working exactly as it should (or at least like
perl thinks it should), in that it is evaluated the first time the module is
loaded, because it is at the top, but after that it has no reason it run
because the script is still running and it isn't in a subroutine that is
called or anything like that.

I think I'll write a subroutine that passes back a dbh handle and call that
sub from every sub I use that interacts with the database - is this the
accepted way to do things?

I should probably reread the camel book chapter on OO and start using that
more, just haven't gotten around to it :-)

Anyways, much thanks for all your help!

Curtis H.

- Original Message -
From: Geoffrey Young [EMAIL PROTECTED]
To: 'Curtis Hawthorne' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 31, 2001 3:14 PM
Subject: RE: mod_perl/DBI problem

snip

 hmph, it's been a while since I've done any Registry.pm work...

 basically, all my stuff is OO now, so I use a method handler that inherits
 from a base Util class and call
 my $dbh = $self-connect;
 where Util::connect() contains the eval() construct.  that works like a
 charm.

 I don't understand why the eval() isn't working as it should, but maybe
its
 a windows thing or maybe I'm missing something - using eval() as an
 exception handling mechansim ought to execute the code every time,
 regardless of whether perl has seen it already.  perhaps its a nested
eval()
 thing...

 at any rate, your suggestions below are good ones to follow - I think
you're
 on the right path.  try creating a util package, or at least a subroutine
 within your script that contains the eval() and passes $dbh back to you
and
 see if that helps.  almost there :)

 --Geoff

 
  Pseudo code of my module:
  eval {
  connect_to_database;
  };
 
  if($@) {
  writeerror;
  clear(%Connected);
  }
 
  sub dostuff {
  return manipulatedatabase;
  }
 
  sub dothings {
  return querydatabase;
  }
 
  So, should I rewrite it so that it makes a new connection
  (but not really
  because of Apache::DBI) in each sub, or have the script call
  a subroutine
  that gives it a database handle to pass to each sub, go at it
  a completely
  different way, or am I way off in my analysis of the problem?
 
  Really confused,
 
  Curtis H.
snip




mod_perl/DBI problem

2001-07-27 Thread Curtis Hawthorne

I'm writing a script that will run under mod_perl that uses DBI to connect
to an MS SQL server.  The script works fine and mod_perl speeds it up quite
a bit.  Every so often, when the script tries to connect to the SQL server,
the connection times out (I think the SQL server's a little slow), and I get
an Internal Server Error message.  My problem is that, instead of trying to
connect to the server again, the next time the script is run, the database
connection handle stays the same and I get the following error in my logs
over and over again Can't call method quote on an undefined value (the
first thing the script does is a $dbh-quote of a variable).  The code that
does the connection to the database is in a module that is used by the
script, but not in a subroutine.

So, how can I have it try to connect to the database again if it fails, but
keep the connection persistent if it doesn't?  Would there be some way to
have the script exit completely when it gets an error like that, even though
it's under mod_perl?

Thanks!

Curtis H.





Re: mod_perl/DBI problem

2001-07-27 Thread Ged Haywood

Hi there,

On Fri, 27 Jul 2001, Curtis Hawthorne wrote:

 So, how can I have it try to connect to the database again if it fails, but
 keep the connection persistent if it doesn't?

Have a look in the Guide, there's lots of stuff in there about
Apache::DBI.  http://perl.apache.org/guide.

73,
Ged.




Re: Apache::DBI problem

2001-05-06 Thread Edmund Mergl

Grigoriy G. Vovk wrote:
 
 Here are my files:
 
 httpd.conf -
 
 Alias /perl/ /usr/local/www/perl/
 PerlModule Apache::DBI
 PerlRequire /usr/local/www/startup.pl
 PerlModule Apache::Registry
 PerlModule Apache::DBI
 PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2
 PerlModule Apache::DB
 Location /perl
 PerlFixupHandler Apache::DB
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options +ExecCGI
 AllowOverride None
 Order allow,deny
 Allow from all
 PerlSendHeader on
 /Location
 
 startup.pl -
 
 use strict;
 $ENV{MOD_PERL} or die not running under mod_perl!;
 use Apache::DBI ();
 use Apache;
 use Apache::Cookie;
 use Apache::Request;
 use Carp();
 $SIG{__WARN__} = \Carp::cluck;
 sub My::ProxyRemoteAddr ($) {
   my $r = shift;
   return unless ($r-connection-remote_ip eq 127.0.0.1);
   if (my ($ip) = $r-header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
 $r-connection-remote_ip($ip);
   }
   return ;
 }
 Apache::DBI-connect_on_init
 (dbi:Pg:dbname=jewelry,'','',
 {
 PrintError = 1,
 RaiseError = 0,
 AutoCommit = 1,
 });
 
 my programm -
 
 use strict;
 use Apache::DBI;


  not necessary, your script should run unchanged under Apache::DBI


 $Apache::DBI::DEBUG = 2;
 use Apache;
 use Carp();
 local $SIG{__WARN__} = \$Carp::cluck;
 my $dbh;
 $dbh = DBI-connect(dbi:Pg:dbname=jewelry, '', '');


if you don't use exactly the same connect-string, as in startup.pl, you
will not get a persistent connection.


 my $r=shift;
 $r-send_http_header('text/html');
 my $sql = select * from tbl_category;
 my $sth = $dbh-prepare($sql);
 my $rs = $sth-execute();
 my @rs;
 while(@rs = $sth-fetchrow_array){
 $r-print($rs[0]\t$rs[1]\n);
 }
 $sth-finish;
 $dbh-disconnect;
 
 and httpd-error.log -
 
 [Sat May  5 16:35:28 2001] [notice] FastCGI: process manager initialized (pid 14154)
 [Sat May  5 16:35:29 2001] [notice] Apache/1.3.19 (Unix) mod_fastcgi/2.2.10 
mod_perl/1.25
 configured -- resuming normal operations
 Default die handler restored.
 14156 Apache::DBI need ping: yes
 14156 Apache::DBI new connect to 
'dbname=jewelryPrintError=1AutoCommit=1'
 [Sat May  5 16:39:27 2001] [error] Not a subroutine reference at
 (eval 225)[/usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Apache/Registry.pm:177] 
line 73.
 
 Line 73 is my $rs = $sth-execute();


your $sth is undefined.


 
 So, does anybody understand what's going on?
 Why my programm doesn't work?
 It works as plain perl script perfect.
 And Apache::Session::Store::Postgres works perfect - it mean, mod_perl
 works with Postgres.
 
 Thank's,
 
 my best regards,
 -
 Grigoriy G. Vovk


always check the return values of all DBI-methods, eg

instead of: $dbh = DBI-connect(..);

use:$dbh = DBI-connect(..) or die db connect error;

and instead of: my $sth = $dbh-prepare($sql);

use:my $sth = $dbh-prepare($sql) or die $DBI::errstr;

or something equivalent.



Edmund

-- 
http://www.edmund-mergl.de
fon: +49 700 edemergl



Apache::DBI problem

2001-05-05 Thread Grigoriy G. Vovk

Here are my files:

httpd.conf -

Alias /perl/ /usr/local/www/perl/
PerlModule Apache::DBI
PerlRequire /usr/local/www/startup.pl
PerlModule Apache::Registry
PerlModule Apache::DBI
PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2
PerlModule Apache::DB
Location /perl
PerlFixupHandler Apache::DB
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
PerlSendHeader on
/Location

startup.pl -

use strict;
$ENV{MOD_PERL} or die not running under mod_perl!;
use Apache::DBI ();
use Apache;
use Apache::Cookie;
use Apache::Request;
use Carp();
$SIG{__WARN__} = \Carp::cluck;
sub My::ProxyRemoteAddr ($) {
  my $r = shift;
  return unless ($r-connection-remote_ip eq 127.0.0.1);
  if (my ($ip) = $r-header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
$r-connection-remote_ip($ip);
  }
  return ;
}
Apache::DBI-connect_on_init
(dbi:Pg:dbname=jewelry,'','',
{
PrintError = 1,
RaiseError = 0,
AutoCommit = 1,
});

my programm -

use strict;
use Apache::DBI;
$Apache::DBI::DEBUG = 2;
use Apache;
use Carp();
local $SIG{__WARN__} = \$Carp::cluck;
my $dbh;
$dbh = DBI-connect(dbi:Pg:dbname=jewelry, '', '');
my $r=shift;
$r-send_http_header('text/html');
my $sql = select * from tbl_category;
my $sth = $dbh-prepare($sql);
my $rs = $sth-execute();
my @rs;
while(@rs = $sth-fetchrow_array){
$r-print($rs[0]\t$rs[1]\n);
}
$sth-finish;
$dbh-disconnect;

and httpd-error.log -

[Sat May  5 16:35:28 2001] [notice] FastCGI: process manager initialized (pid 14154)
[Sat May  5 16:35:29 2001] [notice] Apache/1.3.19 (Unix) mod_fastcgi/2.2.10 
mod_perl/1.25
configured -- resuming normal operations
Default die handler restored.
14156 Apache::DBI need ping: yes
14156 Apache::DBI new connect to 
'dbname=jewelryPrintError=1AutoCommit=1'
[Sat May  5 16:39:27 2001] [error] Not a subroutine reference at
(eval 225)[/usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Apache/Registry.pm:177] 
line 73.

Line 73 is my $rs = $sth-execute();

So, does anybody understand what's going on?
Why my programm doesn't work?
It works as plain perl script perfect.
And Apache::Session::Store::Postgres works perfect - it mean, mod_perl
works with Postgres.

Thank's,

my best regards,
-
Grigoriy G. Vovk




Re: Apache::DBI problem and writting a perl module!!!

2001-01-11 Thread Stas Bekman

On Thu, 11 Jan 2001, R. K . Mallah wrote:

 Stas , I do not face the problem anymore and Apache::DBI is loading
 without any problem. But i remember of facing problem at one point of time.
 may be with some older version.

Ok

 Could u please explain me  what does Apache-module do and where is
 it defined ?

Why does it matter? You won't be able to test most of the Apache:: modules
from the command line, since the environment is wrong.

From ch9 in the eagle book:

=item module()

If you need to find out if a Perl module has already been loaded, the
Imodule() method will tell you.  Pass it the package name of the
module you're interested in.  It will return a true value if the
module is loaded.

Example:

 do { #something } if Apache-module('My::Module');

This method can also be used to test if a C module is loaded.  In this
case, pass it the filename of the module, just as you would use with the
IIfModule directive.  It will return a true value if the
module is loaded.

Example:

 do { #something } if Apache-module('mod_proxy.c');


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





Re: Apache::DBI problem and writting a perl module!!!

2001-01-10 Thread R. K . Mallah


I faced the same problem and had posted similar email
but I found an workaround that is there in the posting.


I get following error when i do
perl -e 'use Apache::Status;use Apache::DBI'
Can't locate object method "module" via package "Apache" at /usr/lib/perl5/site_perl/5.6.0/Apache/DBI.pm
line 202.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

the problem is when preparing menu_item for Apache::Status method
module is
not found under Apache,
do i have to install some other Apache module?
anyway i commented out the if part and made it work like
Apache::Status->menu_item(
 'DBI' => 'DBI connections',
 sub {
 my($r,
$q) = @_;
 my(@s)
= qw(TABLE>TR>TD>Datasource/TD>TD>Username/TD>/TR>);
 for (keys
%Connected) {

push @s, 'TR>TD>', join('/TD>TD>', (split($;, $_))[0,1]),
"/TD>/TR>\n";
 }
 push @s,
'/TABLE>';
 return
\@s;
 }
);
# ) if ($INC{'Apache.pm'} and Apache->module('Apache::Status'));

is it correct ?
why shouldn't it load without any modifications ?
Regards
Mallah



--
Rajesh Kumar Mallah,
Learning Universe Pvt. Ltd,
Piccadily House, 4th Floor,
275-276, Capt. Gaur Marg,
Okhla, Sriniwas puri,
New Delhi 110 065.
M : +919811255597
T : 91-11 6931601-04
W : http://www.egurucool.com
E : [EMAIL PROTECTED]







Edmar Edilton da Silva wrote:
 Hi all,
 I still didn't solve the problem of the Apache::DBI.
It can not be
loaded into the apache's startup.pl file because happens a error during
the starting of the apache, the child processes are not created. For
using the Apache::DBI I had to add the "use Apache::DBI ()" code at
the
beginning of each perl script.
Is it correct? Is the performance of the system damaged? I am working
in
this problem for some days, How I dont solve it, I intend to write
my
own connection pool. Please, can anyone tell me where I can find docs
about this? Thanks for all.


Edmar Edilton da Silva
 Bacharel em Cincia da Computaco -
UFV
 Mestrando em Cincia da Computaco - UNICAMP


--
__ Technology Rules __
Rajesh Kumar Mallah,
M : +919811255597




Re: Apache::DBI problem and writting a perl module!!!

2001-01-10 Thread Stas Bekman

On Wed, 10 Jan 2001, R. K . Mallah wrote:

  I faced the same problem and had  posted  similar email
 but I found an workaround that is there in the posting.


 
 I get following error when i do

 perl -e 'use Apache::Status;use Apache::DBI'

 Can't locate object method "module" via package "Apache" at
 /usr/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 202.
 Compilation failed in require at -e line 1.
 BEGIN failed--compilation aborted at -e line 1.


 the problem is when preparing menu_item for Apache::Status method module
 is
 not found under Apache,

 do i have to install some other Apache module?

it has nothing to do with this. You cannot test Apache modules from the
command line since you aren't running in mod_perl environment.

please read the documentation -- you have to load the Apache::Status
before Apache::DBI.

 anyway i commented out  the if part and made it work like

 Apache::Status-menu_item(

 'DBI' = 'DBI connections',
 sub {
 my($r, $q) = @_;
 my(@s) =
 qw(TABLETRTDDatasource/TDTDUsername/TD/TR);
 for (keys %Connected) {
 push @s, 'TRTD', join('/TDTD', (split($;,
 $_))[0,1]), "/TD/TR\n";
 }
 push @s, '/TABLE';
 return \@s;
}

 );

 # ) if ($INC{'Apache.pm'} and Apache-module('Apache::Status'));


 is it correct ?

 why shouldn't it load without any modifications ?

 Regards
 Mallah

 



 --
 Rajesh Kumar Mallah,
 Learning Universe Pvt. Ltd,
 Piccadily House, 4th Floor,
 275-276, Capt. Gaur Marg,
 Okhla, Sriniwas puri,
 New Delhi 110 065.
 M : +919811255597
 T : 91-11 6931601-04
 W : http://www.egurucool.com
 E : [EMAIL PROTECTED]










 Edmar Edilton da Silva wrote:

  Hi all,
 
  I still didn't solve the problem of the Apache::DBI. It can not be
 
  loaded into the apache's startup.pl file because happens a error
  during
  the starting of the apache, the child processes are not created. For
  using the Apache::DBI I had to add the "use Apache::DBI ()" code at
  the
  beginning of each perl script.
  Is it correct? Is the performance of the system damaged? I am working
  in
  this problem for some days, How I dont solve it, I intend to write my
  own connection pool. Please, can anyone tell me where I can find docs
  about this? Thanks for all.
 
  
  Edmar Edilton da Silva
  Bacharel em Ciência da Computacão - UFV
Mestrando em Ciência da Computacão - UNICAMP
  

 --
 __ Technology Rules __
 Rajesh Kumar Mallah,
 M : +919811255597








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





Re: Apache::DBI problem and writting a perl module!!!

2001-01-10 Thread R. K . Mallah


Stas , I do not face the problem anymore and Apache::DBI is loading
without any problem. But i remember of facing problem at one point
of time.
may be with some older version.
Could u please explain me what does Apache->module do and where
is
it defined ?
and Edmar could you please post the exact problem u are facing,
Regards
Mallah.

Stas Bekman wrote:
On Wed, 10 Jan 2001, R. K . Mallah wrote:
> I faced the same problem and had posted similar
email
> but I found an workaround that is there in the posting.
>
>
> 
> I get following error when i do
>
> perl -e 'use Apache::Status;use Apache::DBI'
>
> Can't locate object method "module" via package "Apache" at
> /usr/lib/perl5/site_perl/5.6.0/Apache/DBI.pm line 202.
> Compilation failed in require at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
>
>
> the problem is when preparing menu_item for Apache::Status method
module
> is
> not found under Apache,
>
> do i have to install some other Apache module?
it has nothing to do with this. You cannot test Apache modules from
the
command line since you aren't running in mod_perl environment.
please read the documentation -- you have to load the Apache::Status
before Apache::DBI.
> anyway i commented out the if part and made it work like
>
> Apache::Status->menu_item(
>
> 'DBI' => 'DBI connections',
> sub {
> my($r, $q) = @_;
> my(@s) =
> qw(TABLE>TR>TD>Datasource/TD>TD>Username/TD>/TR>);
> for (keys %Connected)
{
>
push @s, 'TR>TD>', join('/TD>TD>', (split($;,
> $_))[0,1]), "/TD>/TR>\n";
> }
> push @s, '/TABLE>';
> return \@s;
> }
>
> );
>
> # ) if ($INC{'Apache.pm'} and Apache->module('Apache::Status'));
>
>
> is it correct ?
>
> why shouldn't it load without any modifications ?
>
> Regards
> Mallah
>
> 
>
>
>
> --
> Rajesh Kumar Mallah,
> Learning Universe Pvt. Ltd,
> Piccadily House, 4th Floor,
> 275-276, Capt. Gaur Marg,
> Okhla, Sriniwas puri,
> New Delhi 110 065.
> M : +919811255597
> T : 91-11 6931601-04
> W : http://www.egurucool.com
> E : [EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>
>
> Edmar Edilton da Silva wrote:
>
> > Hi all,
> >
> > I still didn't solve the problem of the
Apache::DBI. It can not be
> >
> > loaded into the apache's startup.pl file because happens a error
> > during
> > the starting of the apache, the child processes are not created.
For
> > using the Apache::DBI I had to add the "use Apache::DBI ()" code
at
> > the
> > beginning of each perl script.
> > Is it correct? Is the performance of the system damaged? I am working
> > in
> > this problem for some days, How I dont solve it, I intend to write
my
> > own connection pool. Please, can anyone tell me where I can find
docs
> > about this? Thanks for all.
> >
> > 
> >
Edmar Edilton da Silva
> > Bacharel em Cincia da Computaco
- UFV
> > Mestrando em Cincia da Computaco - UNICAMP
> > 
>
> --
> __ Technology Rules __
> Rajesh Kumar Mallah,
> M : +919811255597
>
>
>
>
>
_
Stas Bekman
JAm_pH -- Just Another mod_perl Hacker
http://stason.org/
mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] 
http://apachetoday.com
http://logilune.com/
http://singlesheaven.com http://perl.apache.orghttp://perlmonth.com/

--
__ Technology Rules __
Rajesh Kumar Mallah,
M : +919811255597



Re: Apache::DBI problem and writting a perl module!!!

2000-12-03 Thread Perrin Harkins

Edmar Edilton da Silva wrote:
 I still didn't solve the problem of the Apache::DBI. It can not be
 loaded into the apache's startup.pl file because happens a error during
 the starting of the apache, the child processes are not created. For
 using the Apache::DBI I had to add the "use Apache::DBI ()" code at the
 beginning of each perl script.

That will not work.  You have to load Apache::DBI before DBI, as it says
in the documentation.  You need to solve the problem you're getting when
putting Apache::DBI in your startup.pl.  What's the error?  Did you
compile your Apache/mod_perl from source?  Are you using DSO?

- Perrin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




DBI Problem

2000-11-28 Thread Bob Foster

Hi Folks,

Everything is working great but I can't make a connection to my Oracle database (which 
is on another server) using mod_perl.

-Perl 5.005_03 is working great.
-mod_perl 1.24_01 is working great with apache 1.3.14
-DBI 1.14 connections are working great with DBD Oracle 1.06

I can connect to test.cgi and produce the output with 
Options +ExecCGI 
SetHandler cgi-script.

But when I use:
Options +ExecCGI 
SetHandler perl-script 
PerlHandler Apache::Registry 
I get no error message in the error_log, and a simple "The page cannot be displayed" 
in the browser.

I know that test.cgi is being found since I have a 'warn' message in it which gets 
sent to the error_log.

HELP, Please,  I've been working on this for days and have run out of ideas!

Thanks!  

Bob

P.S.  test.cgi follows:

#!/usr/local/bin/perl  
use strict;
use DBI;
warn "hello!";
use CGI qw(:standard);
my $query = new CGI;
my $dbh = DBI-connect( 'dbi:Oracle:GEORGE',
'userid',
'passwork',
{
  RaiseError = 1,
  AutoCommit = 0
}
  ) || die "Database connection not made: $DBI::errstr";

my $sql = qq{ select survey_set_id, pub_id, start_date, end_date from survey_set};
my $sth = $dbh-prepare( $sql );
$sth-execute();

my( $id, $pub_id, $start, $end );
$sth-bind_columns( undef, \$id, \$pub_id, \$start, \$end );

print $query-header;
while( $sth-fetch() ) {
  print "$pub_id, $start, $end\n\n";
}

$sth-finish();

$dbh-disconnect();




Apache::DBI problem

2000-09-12 Thread Evelin Halling



Hi,

I am using Apache::DBI for user authentication 
and it works just fine with one exception, 
it does not kill the sql backend server process starting up during authentication,
so after some time postgres is running out of allowed backend server 
processes and authentication does not work any more.

Please help

I'm using:
perl 5.005_03, 
Apache/1.3.11 (Unix) with mod_perl/1.21,
ApacheDBI-0.87,
DBI-1.13,
PostgreSQL-7.0


thanx,

evelin






Re: Apache::DBI problem

2000-09-12 Thread Perrin Harkins

On Tue, 12 Sep 2000, Evelin Halling wrote:
 I am using Apache::DBI for user authentication and it works just fine
 with one exception, it does not kill the sql backend server process
 starting up during authentication, so after some time postgres is
 running out of allowed backend server processes and authentication
 does not work any more.

That's what Apache::DBI does.  It makes your connections persistent.  If
you want the connections to be re-established and closed on every request,
don't use Apache::DBI.  If you want to use Apache::DBI for speed, try to
get your database to handle more connections or reduce the number of
mod_perl processes by using a proxy server.

- Perrin




Re: Apache::DBI problem..

2000-04-05 Thread Niral Trivedi

Actually I already have MySQL module installed on our machine... Because
I am able to run cgi/perl script which uses DBI module..

I mean I am able to run any normal cgi script.. So, I think that
suggests that we have all the required module installed on our machine..

Niral

Rajesh Kumar Mallah wrote:
 
 Did you install DBD ?? fro the particular database you installed.
 eg for mysql install
 
 cpan install Bundle::DBD::mysql
 
 Rajesh Kumar Mallah
 ---
 Learning Universe Pvt. Ltd.
 59 Mandakini, GK IV, New Delhi 110019
 Tel: (91-11) 6412100, 6480342, 6480365
 http://www.egurucool.com
 email: [EMAIL PROTECTED]
 ---

-- 
Regards...

Niral K. Trivedi, Planet Access Network Inc.
Email : [EMAIL PROTECTED]
Phone : 973-691-4704 x134



Apache::DBI problem..

2000-04-04 Thread Niral Trivedi

All..

I am new to mod_perl so, please forgive me if this questions sounds
stupid..

I have successfully installed mod_perl 1.22 and Apache 1.3.12 under
BSD/OS BSDI 3.1 And able to run normal cgi script... But problem occurs
while I am trying to run script with DBI..

I have successfully installed Apache::DBI from CPAN site which is
version 0.87

When I am trying to start Apache after installing Apache::DBI, I am
getting following errors:
--
Syntax error on line 935 of
/zen/home/niral/Apache/apache/conf/httpd.conf:
Can't load '/usr/local/lib/perl5/site_perl/i386-bsdos/auto/DBI/DBI.o'
for module DBI: can't resolve undefined symbols: Inappropriate file type
or format at /usr/local/lib/perl5/i386-bsdos/5.00401/DynaLoader.pm line
155.

 at /usr/local/lib/perl5/site_perl/DBI.pm line 158
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/DBI.pm line 158.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/Apache/DBI.pm line 4.

./apachectl start: httpd could not be started
---
following is the snippets from my httpd.conf file:
---
Alias /perl/  /zen/home/niral/Apache/apache/test/
#PerlRequire /zen/home/niral/Apache/apache/conf/startup.pl
PerlModule Apache::DBI ### This is line 935

Location /perl
SetHandler  perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options ExecCGI
/Location

Location /perl-status
SetHandler  perl-script
PerlHandler Apache::Status
/Location
]
I have tried to do this using startup.pl file as well.. but getting same
error.. 

After searching different mailing lists, I have found that this is very
common problem for users on RedHat Linux... But couldn't find anything
for BSDI 

I also found one link to
http://perl.apache.org/guide/troubleshooting.html#Can_t_load_auto_DBI_DBI_so_
but don't know how to check that thing?? I mean how can you check that
all modules are compiled with same perl version

Please give me some idea on this..

Thanks in advance for your help..

Niral
-- 
Regards...

Niral K. Trivedi, Planet Access Network Inc.
Email : [EMAIL PROTECTED]
Phone : 973-691-4704 x134



Apache::DBI Problem

2000-01-07 Thread Dennis Megarry

This message was sent from Geocrawler.com by "Dennis Megarry" [EMAIL PROTECTED]
Be sure to reply to that address.

Everything was running fine, i installed mod_perl 
and ApacheDBI, now, I get errors trying to 
connect to mySQL, the message showing up in my 
error_log file is this:

httpd: [Thu Jan  6 22:45:23 2000] [error] 
Undefined subroutine 
Apache::ROOTwww_2eelite_2ecom::cgi_2dbin::get_2ec
gi::configure called at /user3/elite/cgi-
bin/get.cgi line 16.

Also, when I try to start the startup.pl file 
that came with ApapcheDBI i get this error 
message:

Can't locate object method "module" via 
package "Apache" at /usr/local/lib/perl5
/site_perl/5.005/Apache/DBI.pm line 202.
BEGIN failed--compilation aborted at startup.pl 
line 11.

Anyone have an idea what I'm doing wrong?

Dennis



Geocrawler.com - The Knowledge Archive



apache/mod_perl/dbi - problem

1999-12-13 Thread Volker Hess

Hi,

I use to servers with nearly the same configuration:

host 1:

   Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) Debian/GNU
   AuthPostgreSQL/0.7.1 mod_perl/1.21 process 255,
   running since Mon Dec 13 10:57:03 1999

   completely using debian packages

host 2:

   Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) Debian/GNU
   mod_perl/1.21 process 4967,
   running since Sun Dec 12 07:35:09 1999

   mod_perl compiled as DSO using apxs by myself

I wrote a CGI-script connecting to a postgreSQL database.
The script run's well in CGI.pm's offline mode. Also it does his
job on host 2 using Apache::PerlRun _and_ Apache::Registry.
On host 1 with Apache::Registry the script crashes with:

[Mon Dec 13 16:44:23 1999] [error] Cannot connect to 'dbi:Pg:dbname=spix 
postgres' at /home/staufenberg/webroot/htdocs/Bilder/archiv/img.cgi line 38.

I found the same problems with any HTML::Embperl page using DBI/DBD::pg.

Please could you give me an advice where to start debugging?!
Thanx!!!

Volker
-- 
EMail: Volker Hess [EMAIL PROTECTED] 
Uni-GH Siegen . Medienzentrum
57068 Siegen
MZ: http://www.avmz.uni-siegen.de/





Re: apache/mod_perl/dbi - problem

1999-12-13 Thread Stas Bekman

On Mon, 13 Dec 1999, Volker Hess wrote:

 Hi,
 
 I use to servers with nearly the same configuration:
 
 host 1:
 
Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) Debian/GNU
AuthPostgreSQL/0.7.1 mod_perl/1.21 process 255,
running since Mon Dec 13 10:57:03 1999
 
completely using debian packages
 
 host 2:
 
Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) Debian/GNU
mod_perl/1.21 process 4967,
running since Sun Dec 12 07:35:09 1999
 
mod_perl compiled as DSO using apxs by myself
 
 I wrote a CGI-script connecting to a postgreSQL database.
 The script run's well in CGI.pm's offline mode. Also it does his
 job on host 2 using Apache::PerlRun _and_ Apache::Registry.
 On host 1 with Apache::Registry the script crashes with:
 
 [Mon Dec 13 16:44:23 1999] [error] Cannot connect to 'dbi:Pg:dbname=spix 
 postgres' at /home/staufenberg/webroot/htdocs/Bilder/archiv/img.cgi line 38.

Doesn't it print the reason for the failure? Is your code looking like:

man DBI:
 $dbh = DBI-connect($data_source, $username, $password)
   || die $DBI::errstr;

I mean, do you use $DBI::errstr?

It can be a permission problem, your script is running under the username
of the server... 

 
 I found the same problems with any HTML::Embperl page using DBI/DBD::pg.
 
 Please could you give me an advice where to start debugging?!
 Thanx!!!
 
 Volker
 -- 
 EMail: Volker Hess [EMAIL PROTECTED] 
 Uni-GH Siegen . Medienzentrum
 57068 Siegen
 MZ: http://www.avmz.uni-siegen.de/
 
 
 
 



___
Stas Bekmanmailto:[EMAIL PROTECTED]  http://www.stason.org/stas
Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC
perl.apache.orgmodperl.sourcegarden.org   perlmonth.comperl.org
single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com



Re: apache/mod_perl/dbi - problem

1999-12-13 Thread Volker Hess

Thanx Stas,

 Doesn't it print the reason for the failure? Is your code looking like:
 
 man DBI:
  $dbh = DBI-connect($data_source, $username, $password)
|| die $DBI::errstr;
 
 I mean, do you use $DBI::errstr?
 
 It can be a permission problem, your script is running under the username
 of the server... 
 
Yes, apache really says:

DBI-connect failed: connectDB() -- connect() failed: Connection refused
Is the postmaster running at 'localhost' and accepting connections on Unix 
socket '5432'?

But this problem only occurs while running under mod_perl. Offline and
with PerlRun all seems OK. PostgreSQL + database is open on both hosts
via port 5432. Also I found nothing like:

  No pg_hba.conf entry for host 141.99.3.17, user volker, database spix

in postgres.log.


-- 
EMail: Volker Hess [EMAIL PROTECTED] 
Uni-GH Siegen . Medienzentrum
57068 Siegen
MZ: http://www.avmz.uni-siegen.de/