a couple of things to try

finish what you are doing. if you are writing a html page, send your html headers with a 'yay' or 'nay'. Write the whole query, i.e. connect, prepare, execute, disconnect. Then you should be able to find out where it is failing.

my quick two minute below

#!/usr/bin/perl use strict; use warnings; use DBI; use CGI; $ENV{ORACLE_HOME} = "/disk2/oracle/product/10.1.0/db_1"; #declare your ORACLE_HOME in the script... (not the problem here but i +t could become a problem later on) my $dbh = DBI->connect('dbi:Oracle:host=host.domain.tld;sid=SID;port=1 +521', 'USER', 'PASS', { RaiseError => 1, AutoCommit => 0 }); print "Content-type: text/html\n\n"; my $sth0 = $dbh->prepare("SELECT...") or die "Couldn't prepare 1st statement: " . $dbh->errstr; $sth0->execute; while (my @data = $sth0->fetchrow_array()) { my $column1 = $data[0]; my $column2 = $data[1]; square brackets here print $column1 . "\t" . $column2; } $sth0->finish; $dbh->disconnect;

Tobin

Code tags added by GrandFather


In reply to Re: perl remote oracle database connection by Tobin Cataldo
in thread perl remote oracle database connection by cynosure

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.