You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Roberto Benedetti <r....@cineca.it> on 2009/09/07 17:28:42 UTC

detecting oracle connection failures

hi everyone,
   I'm having problems trying to combine Oracle and Tomcat: if I define 
a DB connection to a MySQL or Postgres resource, everything works fine 
and DB failures are properly detected.
conversely, if I define an Oracle DataSource, apparently RDBMS or 
network problems are not detected and my application keeps waiting ad 
libitum, ignoring the "maxWait" parameter.

my conf:
<Context>
     <Resource name="jdbc/myoracle"
         auth="Container"
         type="javax.sql.DataSource"
         driverClassName="oracle.jdbc.OracleDriver"
         url="jdbc:oracle:thin:@host:port:sid"
         username="username"
         password="********"
         maxActive="2"
         maxIdle="2"
         maxWait="2000"/>
     <!-- <WatchedResource>WEB-INF/web.xml</WatchedResource> -->
</Context>

my environment:
- apache-tomcat-6.0.20
- jdk-1.6.0_14
- ojdbc6.jar (2111220 bytes)

is it a driver-specific issue?
I couldn't find out any useful (i.e. pastable) hint. is tomcat+oracle 
such a rare combination?

thanks in advance,
   roberto



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: detecting oracle connection failures

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Roberto Benedetti [mailto:r.benedetti@cineca.it]
> Subject: detecting oracle connection failures
> 
> if I define an Oracle DataSource, apparently RDBMS or
> network problems are not detected and my application
> keeps waiting ad libitum, ignoring the "maxWait" parameter.

You might want to try setting the testOnBorrow and validationQuery attributes for your connection pool.  This will avoid DBCP giving out dead connections.  Doc is here:
http://commons.apache.org/dbcp/configuration.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: detecting oracle connection failures

Posted by David Smith <dn...@cornell.edu>.
I think you've misunderstood what maxWait does.  It tells the pool how
long to have your webapp code wait for a connection when all the
connections in the pool are busy servicing other requests (the pool is
exhausted).  Sounds to me like you've successfully received a
connection, are attempting a transaction and the transaction is hung up
somehow with a potential network issue.  I've not done any work with the
Oracle drivers so maybe someone else on the list has an idea?

--David

Roberto Benedetti wrote:
> hi everyone,
>   I'm having problems trying to combine Oracle and Tomcat: if I define
> a DB connection to a MySQL or Postgres resource, everything works fine
> and DB failures are properly detected.
> conversely, if I define an Oracle DataSource, apparently RDBMS or
> network problems are not detected and my application keeps waiting ad
> libitum, ignoring the "maxWait" parameter.
>
> my conf:
> <Context>
>     <Resource name="jdbc/myoracle"
>         auth="Container"
>         type="javax.sql.DataSource"
>         driverClassName="oracle.jdbc.OracleDriver"
>         url="jdbc:oracle:thin:@host:port:sid"
>         username="username"
>         password="********"
>         maxActive="2"
>         maxIdle="2"
>         maxWait="2000"/>
>     <!-- <WatchedResource>WEB-INF/web.xml</WatchedResource> -->
> </Context>
>
> my environment:
> - apache-tomcat-6.0.20
> - jdk-1.6.0_14
> - ojdbc6.jar (2111220 bytes)
>
> is it a driver-specific issue?
> I couldn't find out any useful (i.e. pastable) hint. is tomcat+oracle
> such a rare combination?
>
> thanks in advance,
>   roberto
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4334


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org