First try to run this query in sqlplus to see if it's suppost to return
results, make sure to login with the same account used in the connect().

Then put || die $DBI::errstr at the end of the connect call or call connect
like this...

my $dbh= DBI->connect("dbi:Oracle:host=<host name>;sid=<sid>", $user,
$password, {RaiseError => 1});

Just in case the call to connect fails.

Also if none of the above give any clues, use trace() to dump a trace file.

Put this before the call to connect

DBI->trace(2, "trace.log");

Then submit the trace.log to the list.

Are you getting any error messages at all at this time?  I assume, by your
message you are not, so it might simply be that no rows are returned.

Ilya




-----Original Message-----
From: [EMAIL PROTECTED]
To: Sterin, Ilya
Cc: '[EMAIL PROTECTED] '
Sent: 9/20/01 8:03 AM
Subject: Re: DBI use with DBD:Oracle module



Here is the code I used for the connection to the database :

my $dbh= DBI->connect("dbi:Oracle:host=<host name>;sid=<sid>", $user,
$password);
$dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;


And the code of the select statement :

my $query= "select type from productTypes";
my $sth= $dbh->prepare($query);
$sth->execute();

my $rawRef;

while(($rawRef= $sth->fetchrow_arrayref())) {
� push(@choices, $rawRef->[0]);
}

and the first call to the fetchrow_arrayref function returned "undef",
so
we never entered in the while loop.



I also tried the following :

my $query= "select type from productTypes";
$choices = $dbh->selectcol_arrayref($query);

and the returned reference ($choices) points to an empty array.


For information : the Oracle server is Oracle 8i
The release of DBI module is : DBI-1.14
The release of DBD::Oracle driver module is : DBD-Oracle-1.09


Robert Jones told me to try "fetchrow_array" instead of
"fetchrow_arrayref"
, but the result is the same.

Thank you all for your help







"Sterin, Ilya" wrote: Yes, I think everyone on this list has
experience:-)

You need to give us a sample code as well as a little more info, before
we
can help, since as of right now, no one knows what you are doing wrong.

Ilya

-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 9/20/01 6:39 AM
Subject: DBI use with DBD:Oracle module

Hi.

I'm trying to use DBI with the DBD::Oracle driver.
The connection seems to work, but even a simple query like "select
col_name from table" doesn't return any record in the fetch.

Does anyone have experienced the use of DBI with Oracle ???

Thanks a lot

Tewfik, a simple developper.
(See attached file: lokmane.vcf)
�<<lokmane.vcf>>
 <<lokmane.vcf>> 

Reply via email to