Bug 42454 - add connection check in oracle dbd driver
Summary: add connection check in oracle dbd driver
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR-util (show other bugs)
Version: HEAD
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2007-05-18 15:58 UTC by Chris Darroch
Modified: 2007-05-22 14:24 UTC (History)
2 users (show)



Attachments
check_conn for apr_dbd_oracle.c (1.55 KB, patch)
2007-05-18 15:59 UTC, Chris Darroch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!