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: FS> Hi, FS> I have problems connecting to an Oracle-DB through apache2. A test FS> script, that works fine when run directly from the shell, fails to FS> connect to the Orcacle DB, when run through apache. As far as I can see, FS> the SID is not passed to the DB server. FS> ..................................... FS> The foolowing message is found in the error log: FS> [Thu Aug 15 09:25:46 2002] [error] 27824: ModPerl::Registry: `DBI->>connect(sun1) failed: Error while trying to retrieve text for FS> error ORA-12505 (DBD ERROR: OCIServerAttach) at FS> /server/apache-dev/perl/test-oracle line 23 FS> ' FS> ....................................... FS> the log file of the Oracle listener on the DB box ahows: FS> 15-AUG-02 09:25:46 * FS> (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 FS> ...................................... FS> The following versions are used: FS> apache 2.0.39 FS> mod_perl: 1.99_04 FS> DBI: 1.30 FS> DBD-Oracle: 1.12 FS> ................. FS> #sample script: FS> #!/usr/local/bin/perl -w FS> BEGIN { FS> $ENV{ORACLE_HOME} = '/opt/oracle/app/product/8.1.6'; FS> $ENV{ORACLE_SID} = 'SPD'; FS> } FS> use CGI; FS> use DBI; FS> my $db_name = 'dbi:Oracle:sun1'; FS> my $db_user = 'webuser'; FS> my $db_pass = 'topsecret'; my $q=CGI->>new; my $dbh = DBI->>connect($db_name, $db_user, $db_pass, FS> {LongReadLen => 65534, FS> RaiseError => 1, FS> AutoCommit => 0}); FS> my $query = q{ FS> SELECT count (*) FS> FROM asdb_mgr.stammdaten14 FS> WHERE bis is null }; my $sth = $dbh->>prepare($query); my $rc = $sth->>execute(); my $count = $sth->>fetchrow_array; print $q->>header; FS> print "Anzahl der SPD-MdBs: $count\n"; $sth->>finish; $dbh->>disconnect; FS> ............................... FS> httpd.conf: FS> Alias /perl /server/apache-dev/perl FS> <IfModule mod_perl.c> FS> PerlRequire "/server/apache-dev/conf/perl-startup.pl" FS> <Location /perl> FS> SetHandler perl-script FS> PerlResponseHandler ModPerl::Registry FS> PerlOptions +ParseHeaders FS> Options +ExecCGI FS> </Location> FS> </IfModule> FS> ...................................... FS> perl-startup.sh: FS> # file:perl-startup.pl FS> # --------------- FS> use Apache2 (); FS> use Apache::compat (); FS> use lib qw(/server/apache-dev/perl/); FS> use ModPerl::Util (); FS> use Apache::RequestRec (); FS> use Apache::RequestIO (); FS> use Apache::RequestUtil (); FS> use Apache::Server (); FS> use Apache::ServerUtil (); FS> use Apache::Connection (); FS> use Apache::Log (); FS> use APR::Table (); FS> use ModPerl::Registry (); FS> use Apache::Const -compile => ':common'; FS> use APR::Const -compile => ':common'; FS> 1; FS> .......................................... FS> Thanks, FS> Fredo -- WBR, Mike P. Mikhailov mailto:[EMAIL PROTECTED] You can have my Unix system when you pry it from my cold, dead fingers