Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Perl code example

RE: Perl code example

From: Hatzistavrou Giannis <j.hatzistavrou_at_telesoft.gr>
Date: Mon, 17 Sep 2001 23:35:37 -0700
Message-ID: <F001.003913D7.20010917234517@fatcity.com>

A good solution might be to read the eviromental parameters of the UNIX session. In there you can set the SID and username/password.

>From within the Perl code then do:

$data_source="dbi:Oracle:" . $ENV{<SID>};
$dbbscs = DBI->connect($data_source,$ENV{<username>},$ENV{<passwd}>);
$sqlstmt_tmcode = "select ... from ...";
$stmt_tmcode = $dbbscs->prepare($sqlstmt_tmcode) || die "Couldn't prepare
the tmcode statement!\n";
$stmt_tmcode->execute || die "Couldn't execute the tmcode statement!\n";

Regards,

Hatzistavrou Yannis

> -----Original Message-----
> From: Hagedorn, Linda [SMTP:lindah_at_epocrates.com]
> Sent: Tuesday, September 18, 2001 01:00
> To: Multiple recipients of list ORACLE-L
> Subject: Perl code example
>
> Hello,
>
> I'm looking for a Perl example passing parameters.
>
> The code below has the userids and passwords hardcoded in clear text in
> the system line, parms 3 and 5 (five lines from the bottom), and the
> Oracle sid is hardcoded also. The code has to be changed to 1) read .pwd1
> and .pwd2 files containing the passwords, and set a literal for the SID
> and substitute it at in the code.
>
> I'm not a Perl coder, and would appreciate any information, hints, or
> links to the manual.
>
> Thanks, Linda
>
>
>
> #!/usr/local/bin/perl
> #
> use CGI qw(:standard);
> #
> $| = 1;
> ($sec,$min,$hour,$mday,$mmonth,$myear,$wday,$yday,$isdst) =
> localtime(time);
> if ($myear < 99) {
> $myear++;
> }
> $myear += 1900;
> $mmonth += 1;
> print header;
> if (!param()) {
> print start_html('dev02 QRX4 DB Refresh'),
> h1('<center>dev02 QRX4 DB Refresh for Formulary qRx Version 4.0'),
>
> hr,
> "<body bgcolor=\"#ffff66\" text=\"#000000\"><br>",
> "Enter a date to start the Oracle database refresh script,<br>",
> "then hit <i>Submit</i> to kick off the refresh for that
> date.<p>",
> start_form,
> "Enter the target refresh date: ",
> textfield('day',$mday,2),
> textfield('month',$mmonth,2),
> textfield('year',$myear,4),
> p, submit('Submit'),
> end_form,
> hr;
> } else {
> # print "You entered :<p>";
> $dy = param('day');
> $mo = param('month');
> $yr = param('year');
> print "You are transferring all data modified on or after ", $dy, "-",
> $mo,"-", $yr, " to update";
> print "\n";
> print "QRX4: Starting script with
> /opt/oracle/scripts/staging/cerebellum/refresh.sh $dy-$mo-$yr\n";
> print "<A HREF=
> <http://parietal.corpdc.epocrates.com/cgi-bin/staging/productionDater_dev0
> 2.pl>>Return to previous page</A>",hr;
>
> print "<pre>";
> system "/opt/oracle/scripts/staging/refresh.sh gui4 pwd1 qrx4 pwd2
> $dy-$mo-$yr dev02";
> print "</pre><hr>";
> print "<A HREF=
> <http://parietal.corpdc.epocrates.com/cgi-bin/staging/productionDater_dev0
> 2.pl>>Return to previous page</A>",hr;
>
> print end_html;
> }
>
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Hatzistavrou Giannis
  INET: j.hatzistavrou_at_telesoft.gr

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Sep 18 2001 - 01:35:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US