On this list, I recall a debate regarding whether or not it's best to cache a javax.sql.DataSource. Some thought that caching the DataSource would allow your code to run faster. Others claimed, on Tomcat at least, that there is no observable performance penalty when getting a DataSource and that by not caching the DataSource and getting it whenever you get your Connection, your code will be more robust in the event your database server should be restarted while your application is running.

Although I haven't tested these claims, I'm getting my javax.sql.DataSource every time I get a Connection (with Connection and PreparedStatement pooling on Tomcat): connection = getDataSource().getConnection();. I'm not sure if this answers your question.

- Jim

At 11:32 AM 1/12/2004 -0500, you wrote:
What is the best practice for establishing a data source connection using
JNDI.
I am using the DAO pattern for database access but where is the best
location for placing the code that initializes the data source?
I am using connection pooling.
I am moving a Struts application into a Portlet.
The core servlet is com.ibm.wps.portlets.struts.WpsStrutsPortlet.

Thanks

______________________________
James Watkin
ACIS Software Development
The Anderson School at UCLA
[EMAIL PROTECTED]
Voice: 1-310-825-5030
Fax: 1-310-825-4835
______________________________



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to