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: access Oracle from Perl

RE: access Oracle from Perl

From: Stephen Lee <Stephen.Lee_at_DTAG.Com>
Date: Fri, 23 May 2003 08:36:43 -0800
Message-ID: <F001.005A187E.20030523083643@fatcity.com>

This might not be suited to heavy-duty data thrashing, but it will work for lightweight stuff.

## The following module implements the opening of a two-way pipe to a process.
use IPC::Open2;

etc.
etc.

   if( ! open2(FROM_SQL, TO_SQL, "sqlplus -s") ) {

      print "\n==> FAILED to open sqlplus\n";
      print "   Exiting script ...\n\n";
      close(FROM_SQL);
      close(TO_SQL);
      exit;

   }

   print TO_SQL <<XXX;

      $userid/$pass\@$SID
      set heading off
      set feedback off
      select name from v\$database;
      exit;

XXX    $success = 0;
   while(<FROM_SQL>) {
      s/  */ /g;
      s/^  *//g;
      s/  *$//g;
      if(/^$/) { next; }
      if(/^$SID$/) { $success = 1; print "   Got name from database OK\n";
next; }

   close(TO_SQL);
   close(FROM_SQL);

   if( $success == 0 ) {

      print "\n==> FAILED to get SID name from database for SID = $SID.\n";
      print "  Either database is down, or we connected to wrong
database.\n";
      exit;

   }

-----Original Message-----

Since there does not appear to be a version of dbd-oracle for Perl 5.8 on windows, any suggestions on how to access Oracle from Perl. I do not have a C compiler and thus can not compile the source.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Stephen Lee
  INET: Stephen.Lee_at_DTAG.Com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Fri May 23 2003 - 11:36:43 CDT

Original text of this message

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