Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
As I turned on more debugging, when the problem occurs, the Apache cached connection reference is different than the database handle reference the query is using. It almost looked like the query is executing on a completely different database handle. Sometimes the query can succeed but sometimes

Re: Apache::DBI connect

2013-11-07 Thread Perrin Harkins
That line stops it from running the ping if $needping is false. The "or" and "||" operators in Perl are sometimes called "short circuit" operators because of this. - Perrin On Thu, Nov 7, 2013 at 4:18 PM, Xinhuan Zheng wrote: > That's fine. I can do more debugging. > > But I have hard time t

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
That's fine. I can do more debugging. But I have hard time to understand this line of code: 200 if ($Connected{$Idx} and (!$needping or eval{$Connected{$Idx}->ping})) { Should this be: 200 if ($Connected{$Idx} and ($needping and eval{$Connected{$Idx}->ping})) { What's the difference be

Re: Apache::DBI connect

2013-11-07 Thread Perrin Harkins
Sorry, I can't determine the problem from your log. You'll need to either run it in the debugger or add some debugging print statements to figure out where it's having trouble. All I can say from that output is that it it's not succeeding in making a new connection after the ping fails, because i

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
I only looked at Apache::DBI not DBI document. My test program works. It reconnects to database OK. I ran it multiple times and every time it reconnects OK. But Apache::DBI doesn't work. You saw the previous debugging info. Where is the problem? - xinhuan From: Perrin Harkins mailto:phark...@g

Re: Apache::DBI connect

2013-11-07 Thread Perrin Harkins
It is in the DBI documentation. Search for "0E0". - Perrin On Thu, Nov 7, 2013 at 12:41 PM, Xinhuan Zheng wrote: > So it returns string '0E0'? The document didn't say that. > > - xinhuan > > On 11/7/13 11:44 AM, "Adam Prime" wrote: > > >perl -e "if ('0E0') { print qq[hi\n] }" > >hi > > > >OE0

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
So it returns string '0E0'? The document didn't say that. - xinhuan On 11/7/13 11:44 AM, "Adam Prime" wrote: >perl -e "if ('0E0') { print qq[hi\n] }" >hi > >OE0 as a string evaluates to true. If you use it as a bareword / >numeric then it's false, which is what your eval example below is doing

Re: Apache::DBI connect

2013-11-07 Thread Adam Prime
perl -e "if ('0E0') { print qq[hi\n] }" hi OE0 as a string evaluates to true. If you use it as a bareword / numeric then it's false, which is what your eval example below is doing. Adam On 13-11-07 11:29 AM, Xinhuan Zheng wrote: one correct - In both cases, the return value is evaluated to

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
one correct - In both cases, the return value is evaluated to false. How do you distinguish? - xinhuan From: Xinhuan Zheng mailto:xzh...@christianbook.com>> Date: Thursday, November 7, 2013 11:12 AM To: Perrin Harkins mailto:phark...@gmail.com>> Cc: mod_perl list mailto:modperl@perl.apache.org>>

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
> I don't actually understand why you did that. What was wrong with the normal > ping? With Oracle DRCP, even though ping succeeds, the connection to the server process is actually terminated. Or ora_ping() may return 0E0 "zero but true" and undef. I don't know. ora_ping() is foreign to me. I

Re: Apache::DBI connect

2013-11-07 Thread Perrin Harkins
On Thu, Nov 7, 2013 at 9:46 AM, Xinhuan Zheng wrote: >The $ok is undef. In the case if the test does succeed (like the first select), $ok returns 0E0. That all sounds good. 0E0 is a true value in Perl. It means "zero but true." And undef is a false value. You don't need to test for undef. >

Re: Apache::DBI connect

2013-11-07 Thread Xinhuan Zheng
Hi Perrin, The DRCP settings is configured as the document expects. I made a simple script outside mod_perl and use DBI to test re-connect to Oracle. The test shows where the problem is. #!/usr/local/bin/perl use DBI; print "first connect\n"; $dbh = DBI->connect('dbi:Oracle:','...','...'); p

Re: Apache::DBI connect

2013-11-07 Thread Perrin Harkins
Have you used the DRCP settings in DBD::Oracle? http://search.cpan.org/~pythian/DBD-Oracle-1.66/lib/DBD/Oracle.pm#Oracle_DRCP >From the description of DRCP, it sounds like you should never lose the connection. You may want to check the configuration. >From your debugging output, it looks like th