Tutorial: How to connect to MySql Database from Servlet?
In this example we will show you how to connect to MySQL database and perform select operation. You will learn the JDBC steps necessary to connect to the MySQL Database and execute the query.
Tutorial Details:
Here we are using the MySQL jdbc driver for making the connection. You can download the jdbc driver for MySQL from http://dev.mysql.com/downloads/connector/j/5.1.html and then put the driver jar file into the classpath.
You have to first create the a table in MySQL database and then connect it through JDBC to show all the records present there.