Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Unable to get data from oracle DB.Using DBI

by Tux (Monsignor)
on Oct 16, 2013 at 13:43 UTC ( #1058443=note: print w/ replies, xml ) Need Help??


in reply to Unable to get data from oracle DB.Using DBI

Some random points ...

  • Does table emp have any records at all?
  • use DBD::Oracle; is unneeded;
  • Include the attributes in connect
  • Add PrintError, PrintWarn and ShowErrorStatement
  • or die "SQL Error…" is useless under RaiseError
  • disconnect is implicit on lexicals
use strict; use DBI; my $host = "192.X.X.X"; my $sid = "mydb"; my $dbh = DBI->connect ("dbi:Oracle:host=$host;sid=$sid;", "SCOTT", " +tiger", { AutoCommit => 0, RaiseError => 1, ora_check_sql => 0, RowCacheSize => 100, PrintError => 1, ChopBlanks => 1, ShowErrorStatement => 1, FetchHashKeyName => "NAME_lc", }) or die "Cannot connect to server". $DBI::errstr\n; my $sth = $db->prepare ("select * from emp where status = 'NEW'"); $sth->execute; while (my @row = $sth->fetchrow_array ()) { print join "\t" => map { $_ // "" } @row; print "\n"; }

If you still don't get anything, you could add DBI->trace (5); or so.


Enjoy, Have FUN! H.Merijn


Comment on Re: Unable to get data from oracle DB.Using DBI
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-07-07 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls