On Thu, Feb 19, 2009 at 12:33 PM, Martin Evans <martin.ev...@easysoft.com>wrote:

> Karl Forner wrote:
>
>> I'm  experiencing a very strange problem : in short, I could not reconnect
>> to a DB using DBI once I successfully connected then failed (with bad
>> password for example), IN THAT ORDER.
>>
>> I made a script reproducing the bug:
>> =================
>> #!/usr/bin/env perl
>> use strict;
>> use warnings;
>> use DBI;
>>
>> my $dsn = 'dbi:Oracle:sid=TITI;host=xxx.yyy.zzz.com;port=1521';
>> my $user        = 'toto';
>> my $password    = $user;
>> my $options =  { AutoCommit => 0 };
>> my @goodinfo = ($dsn, $user, $password, $options);
>> my @badinfo = ($dsn, $user, '', $options);
>>
>> test(@goodinfo);
>> test(@badinfo);
>> test(@goodinfo);
>> test(@goodinfo);
>>
>> sub test {
>>    my $dbh;
>>    eval { $dbh = DBI->connect(@_) };
>>    warn "$...@\n" if $@;
>>    print $dbh ? "Ok" : "NOK";
>>    print "\n";
>> }
>>
>> ========
>>
>> so I expect to get "OK NOK OK OK".
>> But on one computer I get "OK NOK NOK NOK", and on another I get the
>> expected stuff (using the same database)
>>
>> But if I do
>> test(@badinfo);
>>  test(@goodinfo);
>> test(@goodinfo);
>>
>> I get "NOK OK OK" on both !!!!!!!
>>
>> Is this a bug ??
>>
>> Thanks
>> Karl Forner
>>
>> P.S
>>
>> Here are the configs :
>>
>> working computer:
>> arch: ia64
>> OS: Suse ES 9
>> perl -v :  v5.8.6
>> DBI: 1.607
>> DBD::Oracle: 1.16
>>
>> buggy computer:
>> arch: i686
>> OS : ubuntu 8.04
>> perl -v :  v5.8.8
>> DBI: 1.601
>> DBD::Oracle: 1.22
>>
>>
> I think if you add add "ora_envhp => 0" to your options it will work.
> See the DBD::Oracle pod for an explanation.
>

Indeed it works, thnak you.
I think this is something quite dangerous and difficult to solve, maybe it
should be a default or clearly explained in the synopsis.
Typical use case it testing a list of login/password. Here the connection
begins to fail as soon as there is a success followed by a failure, then all
subsequent connections fail.
Moreover it does not happen with previous version of DBD::Oracle.

Thanks again for the answer.

Reply via email to