

Now that Java is installed, we can create a tomcat user, which will be used to run the Tomcat service. Then install the Java Development Kit package with apt-get: We can satisfy that requirement by installing OpenJDK with apt-get.įirst, update your apt-get package index: Tomcat requires Java to be installed on the server so that any Java web application code can be executed. You can learn how to do this by completing our Ubuntu 16.04 initial server setup guide. Prerequisitesīefore you begin with this guide, you should have a non-root user with sudo privileges set up on your server. This tutorial covers the basic installation and some configuration of the latest release of Tomcat 8 on your Ubuntu 16.04 server. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. Select the runtime you want to use (in our case, Tomcat 7) and give a name to your project.Apache Tomcat is a web server and servlet container that is used to serve Java applications.

You can easily create a web project in Eclipse by following these steps: File -> New -> Dynamic Web Project.


Since this is out of the scope of this article we are going to give some general instructions on how to do it, and you can take a closer look at the code attached at the end of this example. In order to make use of the instructions that will follow, and see for yourself how to use JDBC with Tomcat, you need to create a new web project consisting of servlets and jsp pages, that will make use of Tomcat web server for deployment. 2.2 Create a Dynamic Web Project application in Eclipse Just add the jar file in there (along the other jar files that tomcat uses) and you are done with this step. For instance, since we are using Windows, the directory that we are using in this example is C:\tomcat7\lib. In this case however, we need to put the jar file in out Tomcat installation directory, specifically in the $CATALINA_HOME/lib sub-directory. 2.1 Download MySQL Connector and put it in the right folderĪs seen before, we need to download the MySQL Connector from the official MySQL website, and use the mysql-connector-java-5.1.31-bin file. Let’s take a look on what needs to be done. In this case, we still have to use the connector jar file (in a specific folder), as well as make some xml configuration changes. In order to integrate Tomcat and JDBC we are going to follow a different process from before. That was it, you are now ready to start using MySQL in your application! 2. You can see that the jar is added in the build path under the Referenced Libraries section, in the project structure. The path you should follow to add the jar, as instructed above.
