To fix, you need to put MySQL connector to the Java classpath. Import the jar file of the connector to the project folder for the IDE you are using.
Here is the snapshot to place classpath −
Let us now see the code for connectivity in Java with MySQL −
This will produce the following output −