My problem is that the JDBC/DataSource connection pool I define in jetty.xml is established as separate instances in each of the webapps. I want all webapps to share the same pool. I have seen some examples where jetty-env.xml and <resource-ref> in web.xml is involved, but are not able to figure it out.
From: [email protected] [mailto:[email protected]] On Behalf Of Joakim Erdfelt Sent: 3. november 2015 18:14 To: JETTY user mailing list Subject: Re: [jetty-users] Global connection pool Ah, you are referring to a JDBC/DataSource connection pool. That's very, very, specific. (You could have also be referring to HTTP/2 channel connection pools, or HttpClient connection pools, for example) JDBC/DataSource connection pooling is not handled by Jetty. This decisions was made after analyzing the popular DataSource options out there. What we found was that many existing DataSource implementations can do their own Connection Pooling (often far better than a generic solution) And for those DataSource implementations that don't have a built-in connection pooling, there are many excellent, and existing DataSource pooling solutions for those. See things like: * BoneCP * HikariCP * c3p0 * commons-dbcp Since you seem to be using Oracle, I would advise looking into the various Oracle JDBC driver built-in options for connection pooling. And you have a lot of choices within Oracle, as there's got to be about a dozen different DataSource driver options for you (depending on your oracle server and oracle client setups) Joakim Erdfelt / [email protected]<mailto:[email protected]> On Tue, Nov 3, 2015 at 9:22 AM, Per Jørgen Vigdal <[email protected]<mailto:[email protected]>> wrote: The sort of connection pool is not the issue I think. The issue is how to make all webapps share the same pool. I will be using oracle UCP, and present I have this config in jetty.xml : <New id="cf" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg></Arg> <Arg>jdbc/MYDB</Arg> <Arg> <New class="oracle.ucp.jdbc.PoolDataSourceImpl"> <Set name="connectionFactoryClassName">oracle.jdbc.pool.OracleDataSource</Set> <Set name="user">usr</Set> <Set name="password">pwd</Set> <Set name="URL">jdbc:oracle:thin:@//mydb:1521/MYDB </Set> </New> </Arg> </New> But all my webapps makes its own instance of the pool. In my servlets I do a jndi lookup, like this : Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup("jdbc/MYDB "); / Per Jørgen From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Joakim Erdfelt Sent: 3. november 2015 16:01 To: JETTY user mailing list Subject: Re: [jetty-users] Global connection pool Uhm ... What sort of "connection pool" are we referring to here? (There are many kinds) Joakim Erdfelt / [email protected]<mailto:[email protected]> On Tue, Nov 3, 2015 at 7:11 AM, Per Jørgen Vigdal <[email protected]<mailto:[email protected]>> wrote: Hi How can I configure jetty 9 in a way that webapps share one global connection pool. Thank you Per Jørgen. _______________________________________________ jetty-users mailing list [email protected]<mailto:[email protected]> To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users _______________________________________________ jetty-users mailing list [email protected]<mailto:[email protected]> To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
