Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-11-28 15:09 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls