Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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

by Tux (Abbot)
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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058443]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-06-19 13:04 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.