Check out this documentation on establising a connection . It goes into details about what you need to establish a connection to a database using Java.
Apache Tomcat* is the web server component for running Java Servlets and the JavaServer Pages (JSP). It doesn't really have anything to do with using Java to connect to a database, other than the fact that it provides your web application the ability to run.
-Frinny
(*) link to the official website for Apache Tomcat
Comment