Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 20th, 2004, 10:52 PM
prad_kris prad_kris is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 prad_kris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post Connection problem with Oracle (only in browser)

Hi,

I am doing a project with Perl and oracle 9i..I m working on Red Hat8 and have a problem. PLS help me.
This script gets executed successfully in the terminal(i have attached the output below) but when the script is run thru the browser it returns an error. The parameters ORACLE_HOME and NLS_LANG are set as "/opt/ora9/product/9.2" and "AMERICAN" resp.

This is the script:

#! /usr/bin/perl

print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD>";
print "<TITLE> Testing Team List<TITLE>", "\n";
print "</HEAD>", "\n";
print "<BODY>";

use CGI::Carp qw(fatalsToBrowser);
use DBI;
use strict;

my $dbh = DBI->connect('dbi:Oracle:','scott','tiger',{RaiseError => 1,AutoCommit => 0}) || die "Database connection not made:$DBI::errstr";

my $sql = qq{select name from project};
my $sth = $dbh->prepare( $sql );
$sth->execute();
my( $name, $i, $nnn);
$sth->bind_columns( undef, \$name );
while( $sth->fetch() ) {
$nnn=$name;
print " $nnn\n";
}

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

print "\n", "</BODY>", "\n\n";
print "</HTML>", "\n\n";

#end index.pl




This is the Output in the Terminalwhich is executing fine and the results are correct)

[oracle@localhost cgi-bin]$ perl index.pl
Content-type: text/html

<HTML>
<HEAD><TITLE> Testing Team List </TITLE>
</HEAD>
<BODY> name1
name2
name3
name4
name5
name6
name7
name8
name9
name10

</BODY>

</HTML>

[oracle@localhost cgi-bin]$

This is the error from the BrowserI am using Mozilla which comes with Red hat 8)

Content-type: text/html
Software error:

DBI connect('','scott',...) failed: (UNKNOWN OCI STATUS 1804) OCIInitialize. Check ORACLE_HOME and NLS settings etc. at /var/www/cgi-bin/index.pl line 12

For help, please send mail to the webmaster (root@localhost), giving this error message and the time and date of the error.

---------------

The NLS_LANG parameter is set to "AMERICAN".

and the Oracle_Home is also correct

This is .bashrc:

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export ORACLE_BASE=/opt/ora9
export ORACLE_HOME=/opt/ora9/product/9.2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=ora9i
export ORACLE_TERM=xterm
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/ora9/product/9.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/ora9/product/9.2/bin:$PATH
export NLS_LANG=AMERICAN;

PLS help me ....

Thanks in advance,
Pradeep.

Reply With Quote
  #2  
Old February 24th, 2004, 09:42 AM
ldap4u's Avatar
ldap4u ldap4u is offline
Chris Larivee
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Littleton, CO
Posts: 72 ldap4u User rank is Private First Class (20 - 50 Reputation Level)ldap4u User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 49 m 14 sec
Reputation Power: 9
Send a message via MSN to ldap4u
I am a one trick pony ...

It may be because your script, when executed through the browser, does not know the Oracle environment variables ... but it does as the user you are running from the command line.

Try putting the environment variables in the script as follows (tailored to your environment obviously):

$ENV{'ORACLE_HOME'}='/var/oracle/product/920';
$ENV{'LD_LIBRARY_PATH'}='/var/oracle/product/920/lib';
$ENV{'PATH'}='THE PATH OF THE USER THAT WORKS FROM THE COMMMAND LINE';

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Connection problem with Oracle (only in browser)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap