Quick question, are you sure you are connecting to the right db. The reason
I ask, is if you have both production and development environments, which I
have here, you might make a mistake and connect to a different db wher that
table is empty, I've done that plenty of times before.
Seems from the trace file, as if everything is going fine, though no results
are generated from your query? I'll look again.
Ilya
-----Original Message-----
From: [EMAIL PROTECTED]
To: Sterin, Ilya
Cc: ''[EMAIL PROTECTED] ' '
Sent: 9/20/01 8:55 AM
Subject: Re: DBI use with DBD:Oracle module
Hi Ilya
I tried the changes you recommanded, and the result is still the same :
i
have
no exception (die) thrown, the database handler is defined,
but the query doesn't return anything (I tried under sqlplus, and the
given
table has records).
Here is, as an attachment, the DBI log file.
Please, help !!!!
Thanks a lot
"Sterin, Ilya" wrote:
> 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>>
DBI 1.14-nothread dispatch trace level set to 2
Note: perl is running without the recommended perl -w option
-> DBI->connect(DBI:Oracle:host=malabar;sid=aigle, lambda, ****,
HASH(0x131d88))
-> DBI->install_driver(Oracle) for perl=5.006 pid=16779 ruid=1042
euid=1042
install_driver: DBD::Oracle loaded (version 1.09)
<- install_driver= DBI::dr=HASH(0x4d0990)
-> connect for DBD::Oracle::dr (DBI::dr=HASH(0x4d0990)~0x5d9ba0
'host=malabar;sid=aigle' 'lambda' **** HASH(0x13342c))
connect using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS
=(HOST=malabar)(PROTOCOL=tcp)(PORT=1526))(ADDRESS
=(HOST=malabar)(PROTOCOL=tcp)(PORT=1521))
)(CONNECT_DATA=(SID=aigle)))' <- connect= DBI::db=HASH(0x5f8bdc) at
DBI.pm line 408.
-> STORE for DBD::Oracle::db (DBI::db=HASH(0x4fe45c)~INNER
'RaiseError'
1)
<- STORE= 1 at DBI.pm line 433.
-> STORE for DBD::Oracle::db (DBI::db=HASH(0x4fe45c)~INNER
'PrintError'
1)
<- STORE= 1 at DBI.pm line 433.
-> STORE for DBD::Oracle::db (DBI::db=HASH(0x4fe45c)~INNER
'AutoCommit'
0)
<- STORE= 1 at DBI.pm line 433.
<- connect= DBI::db=HASH(0x5f8bdc)
-> prepare for DBD::Oracle::db (DBI::db=HASH(0x5f8bdc)~0x4fe45c
'select
type from ProductTypes')
fbh 1: 'TYPE' NO null , otype 1-> 5, dbsize 10/11, p10.s0
<- prepare= DBI::st=HASH(0x4fe4d4) at OtsIhm.pm line 172.
-> execute for DBD::Oracle::st (DBI::st=HASH(0x4fe4d4)~0x10b978)
dbd_st_execute SELECT (out0, lob0)...
dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
<- execute= '0E0' at OtsIhm.pm line 173.
-> fetchrow_array for DBD::Oracle::st
(DBI::st=HASH(0x4fe4d4)~0x10b978)
<- fetchrow_array= ( ) [0 items] at OtsIhm.pm line 177.
(See attached file: lokmane.vcf)
<<lokmane.vcf>>