Turn on DBI tracing and dump it to a file:  $dbh->trace(3, '/tmp/sqltrace');
Then you can see what is and isn't happening.  It has saved me many hours of
head scratching..

Will
----- Original Message -----
From: "Nico van Leeuwen" <[EMAIL PROTECTED]>
To: "Chip Turner" <[EMAIL PROTECTED]>; "Nico van Leeuwen"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, May 13, 2001 9:11 PM
Subject: Re: Oracle Selects ??


> Only have one set of user/password so yes :o)
>
> Nico.
>
> At 00:07 14-5-01 -0400, Chip Turner wrote:
> >
> >Looks like your query is returning zero rows.  Have you tested it with
> >the same username and password from sqlplus?
> >
> >Chip
> >
> >Nico van Leeuwen <[EMAIL PROTECTED]> writes:
> >
> >> new script different style
> >>
> >> #!/usr/bin/perl -w
> >>
> >> use strict;
> >> use DBI;
> >>
> >> my $dbh = DBI->connect( 'dbi:Oracle:mercury.systime',
> >>                         'systime',
> >>                         'systime',
> >>                         {
> >>                           RaiseError => 1,
> >>                           AutoCommit => 0
> >>                         }
> >>                       ) || die "Database connection not made:
$DBI::errstr";
> >>
> >> print "connected\n";
> >>
> >> my $sql = "SELECT id, is_admin, aktiv, passwort FROM vo_user WHERE
> >> login='nicovl'";
> >> my $sth = $dbh->prepare("$sql");
> >> $sth->execute();
> >>
> >> my( $id, $is_admin, $aktiv, $passwort );
> >> $sth->bind_columns( undef, \$id, \$is_admin, \$aktiv, \$passwort );
> >>
> >> while( $sth->fetch() ) {
> >>   print "$id, $is_admin, $passwort\n";
> >> }
> >>
> >> $sth->finish();
> >> $dbh->disconnect();
> >>
> >>
> >> command prompt:::
> >>
> >> centriumdb:/usr/local/httpd/cgi-bin # ./select-test.pl
> >> connected
> >> centriumdb:/usr/local/httpd/cgi-bin #
> >>
> >> that's all I see... no problems.. no output either... and as I said in
> >> SQL*PLUS the select gives results... and the $dbh->do I have tried work
> fine!
> >>
> >> I am truely puzzled,
> >>
> >> Nico.
> >>
> >>
> >> At 20:57 13-5-01 -0700, Michael A. Chase wrote:
> >> >You really need error checking.  I suggest you add { RaiseError => 1 }
> after
> >> >the password in the connect() call.
> >> >--
> >> >Mac :})
> >> >** I normally forward private database questions to the DBI mail
lists. **
> >> >Give a hobbit a fish and he'll eat fish for a day.
> >> >Give a hobbit a ring and he'll eat fish for an age.
> >> >----- Original Message -----
> >> >From: "Nico van Leeuwen" <[EMAIL PROTECTED]>
> >> >To: <[EMAIL PROTECTED]>
> >> >Sent: Sunday, May 13, 2001 20:27
> >> >Subject: Oracle Selects ??
> >> >
> >> >
> >> >> The following code would work fine for me using mysql... for oracle
it
> >> >> won't work and I have been trying real hard to find out why but it
won't
> >> >work.
> >> >>
> >> >> I have checked the SQL in SQL*PLUS and it worked fine!
> >> >>
> >> >> dbh->do seems to be working fine too....
> >> >>
> >> >> Thanks in advance,
> >> >>
> >> >> Nico.
> >> >>
> >> >> #!/usr/bin/perl -w
> >> >>
> >> >> # Set variables
> >> >>
> >> >> use DBI;
> >> >>
> >> >> $ENV{ORACLE_HOME}  = "/opt/oracle/product/8.1.7";
> >> >> $dbh =
DBI->connect('dbi:Oracle:','[EMAIL PROTECTED]','systime');
> >> >>
> >> >> # Prepare Select
> >> >> $sth = $dbh->prepare("SELECT id, is_admin, aktiv, passwort FROM
vo_user
> >> >> WHERE login='nicovl'");
> >> >>
> >> >> # Execute the Select
> >> >> ($sth->execute);
> >> >>
> >> >> @dbdata = $sth->fetchrow_array;
> >> >>
> >> >> $userid = $dbdata[0];
> >> >> $isadmin = $dbdata[1];
> >> >> $aktiv = $dbdata[2];
> >> >> $passwortdb = $dbdata[3];
> >> >>
> >> >>
> >> >> print "$userid\n";
> >> >
> >
> >--
> >Chip Turner                   [EMAIL PROTECTED]
> >                              RHN Web Engineer
>

Reply via email to