Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: perl remote oracle database connection

by Tobin Cataldo (Monk)
on May 24, 2006 at 22:33 UTC ( [id://551466]=note: print w/replies, xml ) Need Help??


in reply to perl remote oracle database connection

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://551466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found