in reply to Problem getting data from win32::ODBC connection to oracle

Maybe using the Win32::ODBC-error-Methods might help you to locate the error, e.g.
#!perl -w use strict; use Win32::ODBC; my $dsn = "DSN=clamon.world;UID=scott;PWD=tiger"; my $statement = q(SELECT * FROM EMP where EMPNO = 7900); my $db = Win32::ODBC->new($dsn); unless ($db){ my $error = Win32::ODBC::Error; die "Error in connecting to db: $error\n"; } if ($db->Sql($statement){ my $error = $db->error(); die "Error in $statement:\n\t$error\n"; } while ($db->FetchRow){ my %line = $db->DataHash(); foreach my $key (sort keys %line){ print "$key = $hash{$key}\n"; } print "\n"; } $db->Close();

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Replies are listed 'Best First'.
Re: Re: Problem getting data from win32::ODBC connection to oracle
by RuneK (Sexton) on Feb 11, 2002 at 08:11 UTC
    Hi perl -le "s==*F=e=>y~\*martinF~stronat~=>s~^\w~~g=>chop,print", What happens is that everything still seems fine until it reaches the below section. Then it cycles through the while indefinetly, BUT skips the print line for every cycle. That is probably because the $key is empty. Now the wierd thing is why does it cycle indefinetly when there is only one record in that table that matches and why doesn's that single record get printed? I think the problem could be with the setup of the oracle river and DSN on my client, but since I haven't done that before either then it's kind of a mess. Any ideas?
    while ($db->FetchRow){ #<-Cycles indefinetly my %line = $db->DataHash(); foreach my $key (sort keys %line){ print "$key = $hash{$key}\n"; #<-Skips every time } print "\n";