Understanding ResorceLink property inheritance
My scenario is this, I have several applications running on a tomcat, all of
them access the same database I want them to be inside the same pool so the
number of connections oppened can be sensibly managed using the same
parameters. All of that works as of now.
Additionally I also want them to connect to the database using different users
so that's easier to identify which application is running which processes in
the database.
My understanding is that I could do that with setting a Resource in my
server.xml with all the pool configuration parameters set and a ResourceLink in
the context.xml of the application with only the username and password set.
That more or less works. Indeed if setup the scenario described in the above
paragraph I can set a different username and password for the Resource in the
ResourceLink, however it seems that tomcat "forgets" every other parameter of
the Resource driverClass,url, and, more importantly maxActive, maxIdle,
initialSize all gets "forgotten" by tomcat.
Why is that happening?
I'm using tomcat 10.1.28 with java 22.0.2 from openjdk.
This is the ResourceLink that inherits all parameters from server.xml:
<ResourceLink
name="jdbc/mydatabase"
global="jdbc/mydatabase"
type="javax.sql.DataSource"
/>
And this is one that forgets all parent parameters:
<ResourceLink
name="jdbc/mydatabase"
global="jdbc/mydatabase"
type="javax.sql.DataSource"
driverClassName="..."
url="..."
username="..."
password="..."
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
/>