How Tomcat, JDBC and Spring boot App works together?


This Content is from Stack Overflow. Question asked by Hacke

I’m confused about where Tomcat (standalone), JDBC and Spring boot App sit and how they communicate.

  • Where do all three sits ?
  • Is JDBC exist as separate JRE or execute from the app ?? or from Tomcat
  • Where does tomcat sits relative to JDBC??
  • How tomcat use JDBC to manage connection pooling ??
  • If i dont use JNDI datasource will tomcat connection still pooling work?

Below is my scenario for which I need answers.
I’ve a project, and I’m planning to use AWS Secret Manager. But my app currently uses JNDI (context.xml) for DataSource. This context.xml has entries for username, password, db url and driver class name.

I can fetch db secrets from AWS manager via api in my App and set them as ENVIRONMENT variable,then I could set values from ENVIRONMENT variables into context.xml, but you know its not possible as context.xml is read only once at tomcat startup, at that time who will fetch aws db secrets since the app is not running yet ??

I dont want separate script to fetch aws db secrets.


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?