hi werner.

thanks for your feedback.

At 23:20 03/01/12 -0800, you wrote:
>
> one question regarding the above example and castor usage in a servlet
> environment in general though, does a new Database object need to be
> obtained for each method (or call from a servlet)?  from what i've read,
> the Database object is not thread-safe, so the previously described seems
> to be the correct approach, but would like confirmation.
Yes, indeed. I've been working on a project where we deployed Castor as
part of a web application on Tomcat/ServletExec 4.1/Websphere 4.0, and
you'll have to get a fresh Database instance for each thread.
ok, thank you for the clarification.


> in a servlet environment, if obtaining a new Database object for each
> method (or call from a servlet) is the correct approach, how does this
> impact performance since it seems that 1 Database object = 1 database
> connection.  if that is the case, should a pool of Database objects be used
> in such an environment?  if so, are there any existing projects (i.e.
> jakarta commons) that offer such pooling ability?
Why not rely on the pooling mechanism of your container, i.e. jboss in
your case. Just setup and configure a JDBC connection pool, and make it
available to Castor b ytelling Castor to obtain JDBC connections from a
specified enrty in a JNDI naming tree ? That way, the overhead
associated to obtaining fresh Database instances for each thread should
be minimal.
good point. i will look into this. in the case where a container is not used and thus no pooling, does castor itself provide Database (connection) pooling or is that the responsibility of the application using castor? just wondering if something like jakarta's commons pool (http://jakarta.apache.org/commons/pool.html) should be used in a non-app server environment?

thank you again.

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to