When you add the mysql-connector jar, it is available for class compilations of your Project code. Usually the drivers would be loaded using reflection, i.e. through Class.forName("driver_class_name_here")
. This happens during the run-time and compiler need not bother about what class name is being provided.
Usually the web-applications are packaged as war archives and deployed into the web-containers or servers. When the server executes on these archives, it expects the referred class in the classpath. The classpath includes many locations and one among them is the WEB-INF\lib
folder of the archive.
When we build the web-archive through Eclipse or by using build tools like ant or maven, we need to specify what to be included inside the archive. On Eclipse, we do that through the Deployment Assembly
tab on Project Properties.
For a web-project with the following structure:

We add the specific library to the archive through Deployment Assembly
> Add
> Java Build Path Entries
> Next
, select the libraries and say Finish
. We specify that the mysql connector to be included into the archive as:
