Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Connecting to Oracle DB using DBI from CGI script

by moritz (Cardinal)
on Jul 05, 2010 at 06:24 UTC ( #848019=note: print w/replies, xml ) Need Help??

in reply to Connecting to Oracle DB using DBI from CGI script

Tell us how it fails. Compare environment variables, and adapt them.
  • Comment on Re: Connecting to Oracle DB using DBI from CGI script

Replies are listed 'Best First'.
Re^2: Connecting to Oracle DB using DBI from CGI script
by netcooluser (Initiate) on Jul 05, 2010 at 09:52 UTC I am getting the blank page after this i.e Netcool : Historical Report Version 2.0 I am setting the environment like the one explained below $ENV{'ORACLE_HOME'}="/u01/app/oracle/product/10.2.0/client_1"; $ENV{ORACLE_SID}=$ORACLE_SID; $ENV{'LANG'}="C"; $ENV{'LD_LIBRARY_PATH'}="/u01/app/oracle/product/10.2.0/client_1/lib"; Please guide on this

      If you set up Oracle environment variables inside a script that loads the Oracle client libraries, you have to set up the variables before the libraries are loaded:

      • You can set up %ENV in a BEGIN block, at least before loading DBD::Oracle implicitly via DBI->connect() or explicitly, better even before loading DBI.
      • You can wrap your script in a shell script that sets the variables before passing control to your script via exec.
      • You can add PassEnv or SetEnv directives to the Apache configuration.

      I prefer the last way, so no script has to be modified and all scripts automatically get the right Oracle configuration.


      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      The first thing I always check when CLI works but web doesn't, is that I have my Content-Type line correct.
      You need two newlines after it:
      print "Content-Type: text/html\n\n";
      At least about 60% of the time for me, that fixes my main issue of not seeing anything, or rendering the page as text rather than html.
      Definitely check out marto's links, those are nice tutorials.
        The below is a piece of code what we have in the environment
        #!/usr/bin/perl use DBI; use Date::Manip; #use String::Substrings; use Fcntl; #The Module $ENV{'ORACLE_HOME'}="/u01/app/oracle/product/10.2.0/client_1"; $ENV{'LD_LIBRARY_PATH'}="/u01/app/oracle/product/10.2.0/client_1/lib"; print "content-type: text/html \n\n"; print "<font face=verdana size=3><b>Netcool : Historical Report Versio +n 2.0</b></font><hr size=1 noshade color=white>"; ##-----------database connection #################### $dbh = DBI->connect('dbi:Oracle:orcl','username','password', { RaiseEr +ror => 1, AutoCommit => 0 }) or die "\n----------Unable for connect t +o server $DBI::errstr\n";
        I am using https protocol for accessing the url Please suggest any modification to be done.

        20100706 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://848019]
[marto]: good morning all
[Corion]: Hi marto!
[Corion]: I hope you had a good weekend!
[Discipulus]: good morning again monks!
[choroba]: Good morning!
[Corion]: I have a rough plan to release an ImageNet classifier in Perl (well, using pretrained data, but still a nice toy)
Discipulus is going mad with the new win10 client.. tried mv Cortana /dev/null but no succes
[Corion]: Ouch - another pretrained set is available, using images from IMDB and Wikipedia. So I expect interesting results for non-PR images where people are pictured that are not made up

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2017-09-25 08:29 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (277 votes). Check out past polls.