For connecting java application with the mysql database, you need to follow 5 steps to perform database connectivity:
1)Driver class:The driver class for the mysql database is com.mysql.jdbc.Driver.
2)Connection URL:The connection URL for the mysql database is jdbc:mysql://localhost:3306/alok where jdbc is the API, mysql is the database, localhost is the server name on which mysql is running, we may also use IP address, 3306 is the port number and alok is the database name.
3)Username:The default username for the mysql database is root.
4)Password: Password is given by the user at the time of installing the mysql database. In this example, we are going to use root as the password.
Example to Connect Java Application with mysql database: