Re: apache2, DBD/Oracle problem

2002-08-16 Thread Fredo Sartori

Hi,

the problem connecting to an oracle DB through mod_perl is solved: the
solution was, to convert the script into a mod_perl handler as it was
suggested by Stas. I adopted the code posted by Atsushi Fujita and it
worked just perfect for me.

So, thank you all for your help.

Fredo

-- 
Dr. Fredo SartoriTel. 030-227-55061
SPD-Fraktion im Deutschen Bundestag  FAX  030-227-56169
Platz der Republik   e-mail: [EMAIL PROTECTED]
11011 Berlin




apache2, DBD/Oracle problem

2002-08-15 Thread Fredo Sartori

Hi, 

I have problems connecting to an Oracle-DB through apache2. A test
script, that works fine when run directly from the shell, fails to
connect to the Orcacle DB, when run through apache. As far as I can see,
the SID is not passed to the DB server. 

. 
The foolowing message is found in the error log: 

[Thu Aug 15 09:25:46 2002] [error] 27824: ModPerl::Registry:
`DBI-connect(sun1) failed: Error while trying to retrieve text for
error ORA-12505 (DBD ERROR: OCIServerAttach) at
/server/apache-dev/perl/test-oracle line 23 
' 

... 
the log file  of the Oracle listener on the DB box ahows: 


15-AUG-02 09:25:46 *
(CONNECT_DATA=(SID=*)(SERVICE_NAME=sun1.)(CID=(PROGRAM=)(HOST=ollenhauer)(USER=www-adm)))
 * (ADDRESS=(PROTOCOL=tcp)(HOST=172.22.250.27)(PORT=53048)) sh * * * 0 

.. 
The following versions are used: 
apache 2.0.39 
mod_perl: 1.99_04 
DBI: 1.30 
DBD-Oracle: 1.12 


. 
#sample script: 
#!/usr/local/bin/perl -w 

BEGIN { 
$ENV{ORACLE_HOME} = '/opt/oracle/app/product/8.1.6'; 
$ENV{ORACLE_SID}  = 'SPD'; 
} 

use CGI; 

use DBI;   

  
my $db_name = 'dbi:Oracle:sun1';  
my $db_user = 'webuser'; 
my $db_pass = 'topsecret'; 

my $q=CGI-new; 

my $dbh = DBI-connect($db_name, $db_user, $db_pass, 
   {LongReadLen = 65534, 
RaiseError  = 1, 
AutoCommit  = 0}); 

my $query = q{ 
SELECT count (*) 
FROM asdb_mgr.stammdaten14 
WHERE bis is null  }; 

my $sth = $dbh-prepare($query); 

my $rc  = $sth-execute(); 

my $count = $sth-fetchrow_array; 

print $q-header; 
print Anzahl der SPD-MdBs: $count\n; 

$sth-finish; 

$dbh-disconnect; 

... 
httpd.conf: 

Alias /perl  /server/apache-dev/perl 
IfModule mod_perl.c 

  PerlRequire /server/apache-dev/conf/perl-startup.pl 

Location /perl 
   SetHandler   perl-script 
   PerlResponseHandler ModPerl::Registry 
   PerlOptions +ParseHeaders 
   Options  +ExecCGI 
/Location 

/IfModule 

.. 
perl-startup.sh: 

#  file:perl-startup.pl 
#  --- 
  use Apache2 (); 
  use Apache::compat (); 
  
  use lib qw(/server/apache-dev/perl/); 
  
  
  use ModPerl::Util ();   
  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; 

.. 


Thanks, 

Fredo 

-- 
Dr. Fredo SartoriTel. 030-227-55061
SPD-Fraktion im Deutschen Bundestag  FAX  030-227-56169
Platz der Republik   e-mail: [EMAIL PROTECTED]
11011 Berlin




Re: apache2, DBD/Oracle problem

2002-08-15 Thread Fredo Sartori

Hello Mike,

the code works from the shell as a regular perl script. The service is
correctly resolved with tnsping.

Fredo

Am Don, 2002-08-15 um 10.05 schrieb Mike P. Mikhailov:
 Hello Fredo Sartori,
 
 You are connecting to Oracle with service specified in connect
 string. Does this service resolves correctly with tnsping ?
 
 Does this code work correctly as regular perl script ?
 
 Thursday, August 15, 2002, 1:44:34 PM, you wrote:
 
 -- 
 WBR, Mike P. Mikhailov
 mailto:[EMAIL PROTECTED]
 
 You can have my Unix system when you pry it from my cold, dead fingers
 
 
-- 
Dr. Fredo SartoriTel. 030-227-55061
SPD-Fraktion im Deutschen Bundestag  FAX  030-227-56169
Platz der Republik   e-mail: [EMAIL PROTECTED]
11011 Berlin




Re: [OT] Re[2]: apache2, DBD/Oracle problem

2002-08-15 Thread Fredo Sartori

Hello Mike,

of course: the error message of the listener is correct: theres is no
SID sent to the DB server. But, if the same script is run from the
command line, the SID is transmitted. 

Fredo

Am Don, 2002-08-15 um 11.34 schrieb Mike P. Mikhailov:
 Hello Fredo Sartori,
 
 Hmm... It looks like a TNS error.
 
 TNS-12505 TNS:listener could not resolve SID given in connect descriptor
 
 I think it has nothing to do with mod_perl :(
 
 Thursday, August 15, 2002, 3:10:59 PM, you wrote:
 
 FS Hello Mike,
 
 FS the code works from the shell as a regular perl script. The service is
 FS correctly resolved with tnsping.
 
 FS Fredo
 
 FS Am Don, 2002-08-15 um 10.05 schrieb Mike P. Mikhailov:
  Hello Fredo Sartori,
  
  You are connecting to Oracle with service specified in connect
  string. Does this service resolves correctly with tnsping ?
  
  Does this code work correctly as regular perl script ?
  
  Thursday, August 15, 2002, 1:44:34 PM, you wrote:
  
  -- 
  WBR, Mike P. Mikhailov
  mailto:[EMAIL PROTECTED]
  
  You can have my Unix system when you pry it from my cold, dead fingers
  
  
 
 
 
 -- 
 WBR, Mike P. Mikhailov
 mailto:[EMAIL PROTECTED]
 
 I believe in God, only I spell it Nature.
 
 
-- 
Dr. Fredo SartoriTel. 030-227-55061
SPD-Fraktion im Deutschen Bundestag  FAX  030-227-56169
Platz der Republik   e-mail: [EMAIL PROTECTED]
11011 Berlin




segmentation faults

2000-12-13 Thread Dr. Fredo Sartori

Apache produces segmentation faults when receiving arbirary 
requests.

I am running apache-1.3.14 with php-4.0.3pl1, mod_ssl-2.7.1 and 
mod_perl-1.24_02 (from the CVS tree) on solaris 2.7. 
The perl version installed is 5.6.0.

According to the backtrace of gdb the problem seems to be
located in mod_perl:

#0  0x71170 in perl_header_parser (r=0x449040) at mod_perl.c:1021
#1  0x1b5bcc in run_method (r=0x449040, offset=38, run_all=1) at http_config.c:368
#2  0x1b5dc0 in ap_header_parse (r=0x449040) at http_config.c:405
#3  0x1d29fc in process_request_internal (r=0x449040) at http_request.c:1216
#4  0x1d2f0c in ap_process_request (r=0x449040) at http_request.c:1298
#5  0x1c6b34 in child_main (child_num_arg=0) at http_main.c:4298
#6  0x1c6eac in make_child (s=0x3ff040, slot=0, now=976692436) at http_main.c:4466
#7  0x1c73c0 in perform_idle_server_maintenance () at http_main.c:4630
#8  0x1c7b30 in standalone_main (argc=4, argv=0xffbefc04) at http_main.c:4862
#9  0x1c8460 in main (argc=4, argv=0xffbefc04) at http_main.c:5123

It appears that the version of mod_perl ist not the problem: 1.24_01 and 1.23
produce crashes too. 

Has anaybody seen similar effects? Is this a solaris specific problem? 
Is perl 5.6.0 in charge of the trouble?

Any hint is greatly appreciated!

Fredo

--
Dr. Fredo SartoriTel. 030-227-55061
SPD-Fraktion FAX  030-227-56169
Platz der Republik   e-mail: [EMAIL PROTECTED]
11011 Berlin