You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Will Stranathan <wi...@thestranathans.com> on 2001/10/06 16:05:08 UTC

Docs on Tyrex Pools

I think the documentation needs to be changed on jndi-resources-howto.html.

I had posted several messages regarding Tyrex not actually pooling my 
connections to my database, and didn't really get much feedback, except 
that I was getting new DataSources on each call.  When I worked around 
that, it was still creating brand new physical connections.

So I sent a message to the Tyrex mailing list, and it turns out that 
your JDBC driver has to support either ConnectionPoolDataSource or 
XADataSource - so using Tyrex for connection pools is absolutely 
useless.  It doesn't provide pooling for drivers that don't support it, 
and if I had a driver that supported it, I wouldn't need Tyrex because I 
can just use the proper classname and driver in the <Resource> element 
in my server.xml.

All this to say a couple of things:

1) The documentation implies that by the use of Tyrex, Catalina has a 
built-in mechanism for connection pooling, which is wrong.  Catalina 
provides an InitialContext implementation to which 
ConnectionPoolDataSources (or any arbitrary object) can be bound.
2) If Tyrex is only being used for implementing a connection pool, it's 
not doing its job - so why is it there?

I know that I simply don't understand how ConnectionPoolDataSources and 
XADataSources are supposed to be implemented, so I'm probably mostly 
wrong in my message here.  However, as a USER of Tomcat, I was given the 
impression by the documentation that I could actually get a pool of 
connections by putting the correct information in my server.xml - which 
is only half right - I have to put the correct information in 
server.xml, AND I have to use a driver which implements 
javax.sql.ConnectionPoolDataSource.

Regards,
Will Stranathan


Re: Docs on Tyrex Pools

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
	I can't address the documentation, but as for your JDBC problem...

	It seems like you have two choices.  You can write a little
wrapper to make a "normal" JDBC connection look like an "XA" JDBC
Connection, but that is perhaps not the greatest solution.  Because they
still won't be truly 2-phase commit connections - they would always agree
to commit, even if it wasn't really possible, so if there was some sort of
problem you'd end up with a heuristic exception any time the wrappered
connection wasn't first.  Of course, if you're always using exactly one
connection per transaction, you probably don't care.  If you're not using
J2EE transactions around your DB conections, then you *really* don't want
this.
	The other choice is to just use a pooling system that handles
normal JDBC connections.
	I worked on both of these for JBoss.  If you want help, code, or a
library, let me know.  There's also another library available called
PoolMan that pools JDBC connections, though I'm not that familiar with it.

Aaron

On Sat, 6 Oct 2001, Will Stranathan wrote:
> I think the documentation needs to be changed on jndi-resources-howto.html.
>
> I had posted several messages regarding Tyrex not actually pooling my
> connections to my database, and didn't really get much feedback, except
> that I was getting new DataSources on each call.  When I worked around
> that, it was still creating brand new physical connections.
>
> So I sent a message to the Tyrex mailing list, and it turns out that
> your JDBC driver has to support either ConnectionPoolDataSource or
> XADataSource - so using Tyrex for connection pools is absolutely
> useless.  It doesn't provide pooling for drivers that don't support it,
> and if I had a driver that supported it, I wouldn't need Tyrex because I
> can just use the proper classname and driver in the <Resource> element
> in my server.xml.
>
> All this to say a couple of things:
>
> 1) The documentation implies that by the use of Tyrex, Catalina has a
> built-in mechanism for connection pooling, which is wrong.  Catalina
> provides an InitialContext implementation to which
> ConnectionPoolDataSources (or any arbitrary object) can be bound.
> 2) If Tyrex is only being used for implementing a connection pool, it's
> not doing its job - so why is it there?
>
> I know that I simply don't understand how ConnectionPoolDataSources and
> XADataSources are supposed to be implemented, so I'm probably mostly
> wrong in my message here.  However, as a USER of Tomcat, I was given the
> impression by the documentation that I could actually get a pool of
> connections by putting the correct information in my server.xml - which
> is only half right - I have to put the correct information in
> server.xml, AND I have to use a driver which implements
> javax.sql.ConnectionPoolDataSource.
>
> Regards,
> Will Stranathan
>