So, could someone summarize for me the different ways of creating a JDBC DataSource in Tomcat?

I will start the summary, so that it's easier to correct/complete. Please fill in the gaps ;-)

1. Have the DataSource defined in your application's context.
That way, if you have two apps, you have to copy the datasource definition from one to the other.
Two connection pools will be created.

2. Have the DataSource defined in DefaultContext.
   If you have two apps, you need to ...
   ... connection pool(s) will be created.

3. Have the DataSource defined in GlobalNamingResources.
   If you have two apps, you need to ResourceLink in both contexts.
   ... connection pool(s) will be created.

Thank you very much.

Antonio Fiol


Jacob Kjome wrote:

At 03:44 PM 1/9/2004 -0600, you wrote:

Bingo!!! That was it.

It might be a good idea to add a paragraph to the JDBC DataSources section of the documentation that mentions:

(a) That global datasources are defined in <GlobalNamingResources> of server.xml
(b) The need for the <ResourceLink> in the application context .xml file

I had the mistaken impression that anything placed in the server.xml file was automatically applied to all application contexts. I am sure that others make the same mistake.

Thanks, I have been pulling my hair on this issue for almost a month.


This is true for <DefaultContext>. Maybe you were confusing <GlobalNamingResources> with that. The latter lets you define things once and let applications link to it if they want the service whereas the former makes the service available for every app whether it is wanted or not.

Jake




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to