Bug 42454

Summary: add connection check in oracle dbd driver
Product: APR Reporter: Chris Darroch <chrisd>
Component: APR-utilAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: bojan, chrisd
Priority: P3 Keywords: PatchAvailable
Version: HEAD   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: check_conn for apr_dbd_oracle.c

Description Chris Darroch 2007-05-18 15:58:32 UTC
Please find included in this PR a patch that implements the apr_dbd_check_conn()
function for the apr_dbd_oracle.c driver.  So far as I know (I could be wrong!)
there isn't a simple OCI function to check for connection health; instead I
implemented something similar to what seems to be recommended for use in the
JNDI validationQuery field in Tomcat and other similar applications.  Thanks to
my colleague Jeff Gelb for this pointing out.
Comment 1 Chris Darroch 2007-05-18 15:59:16 UTC
Created attachment 20218 [details]
check_conn for apr_dbd_oracle.c

Should apply to APR-util HEAD as of 18/05/2007.
Comment 2 Bojan Smojver 2007-05-21 20:13:10 UTC
Thanks for the patch Chris. I'm guessing "SELECT 1 FROM dual" is some kind of
Oracle-ism for "am I connected?", right? I'm also guessing this should return
precisely one row.
Comment 3 Chris Darroch 2007-05-22 09:46:39 UTC
The "dual" pseudo-table is kind of a scratch table in Oracle which you can use
in statement where you just need a placeholder, e.g., "SELECT SYSDATE FROM dual"
to get the current date, etc.  So this statement should always return one row,
as you say.  (The user doesn't need to have created a "dual" table; it's
always available for use in statements.)
Comment 4 Bojan Smojver 2007-05-22 14:24:00 UTC
Fixed in r540761. Thanks for the patch Chris!