I'll totally remove factory. It was necessary in my 4.1 build.

I'll also tweak the other ms time settings, and the WhileIdle - to borrow, like 
you suggest and see if that works better, of if at all.

I'll also try removing the resource-ref and see what occurs.

Thanks, Chris.


-----Original Message-----
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Thursday, February 25, 2010 3:26 PM
To: Tomcat Users List
Subject: Re: DB connection error -Tomcat 6 config

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry,

On 2/25/2010 3:45 PM, Propes, Barry L wrote:
> Should be noted: for the factory type in the params below, I tried 
> both factory="org.apache.commons.dbcp.BasicDataSourceFactory" and 
> factory="org.apache.dbcp.BasicDataSourceFactory", each to no avail.

How about either factory="org.apache.tomcat.dbcp.BasicDataSourceFactory"
or specifying no factory at all and accepting the default (which is that shown 
above)?

> I removed the commons ref to test out since there's no commons/lib dir 
> in TC 6.0.24, unlike in TC 4.1.31


Right: common/lib, server/lib, and shared/lib are essentially all merged into a 
single /lib in Tomcat 6. You can play with catalina.properties and make all 
kinds of ClassLoader hierarchies, but it's usually not worth it.

> <Context>
>   <!-- omitting - factory="oracle.jdbc.pool.OracleDataSourceFactory" 
> below--> <Resource name="jdbc/myoracle"
> auth="Container" 
> type="javax.sql.DataSource"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>  maxActive="125" 
>  maxIdle="15" 
>  maxWait="7000"
>  removeAbandoned="true"
>  removeAbandonedTimeout="30"
>  logAbandoned="true"
> username="user_name" 
> password="pass_word" 
> driverClassName="oracle.jdbc.OracleDriver"
> url="jdbc:oracle:thin:@159.177.102.100:1526:MYSID"
> minEvictableIdleTimeMillis="5000"
> timeBetweenEvictionRunsMillis = "10000"
> testWhileIdle="true"
> />
> </Context>

All that looks okay to me, although 700ms isn't a long time to wait for a 
connection to come back from the pool: my guess is that you'd rather wait for a 
while for a connection and give the user a complete, if late, response rather 
than just giving them an error screen.

My position is that testWhildIdle isn't really useful: if you test on borrow, 
that's usually sufficient unless you want to basically eliminate the 
possibility that a connection will have to be re-established during a user 
request.

Finally, 30 seconds is a very short "abandoned timeout", though only you can 
determine what is appropriate in your environment. If you have some code which 
executes 3 10-second queries, then your connection is considered abandoned :(

> in webapps/WEB-INF/web.xml
> 
> <resource-ref>
> <description>My Ora datasource</description> 
> <res-ref-name>jdbc/myoracle</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>

In my experience, <resource-ref> is not necessary in web.xml but does follow 
the spec.

So, still getting this error, then:
> javax.servlet.ServletException: javax.naming.NameNotFoundException: 
> Name jdbc is not bound in this Context

?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuG6v8ACgkQ9CaO5/Lv0PACzQCgjVa3oW+0SH14un73MsEFj5k6
yKwAoKSyLVqESWo4CxgiLOgMqXy+0ZNR
=GAHw
-----END PGP SIGNATURE-----

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


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

Reply via email to