In this video Lesson, I am gonna describe the MySQL Relational Database Management System.
I presume that you are having some knowledge on RDBMS and the MySQL language.

Steps of JDBC Program are as follows :

Allocate a Connection object, for connecting to the database server.
Allocate a Statement object, under the Connection created earlier, for holding a SQL command.
Write a SQL query and execute the query, via the Statement and Connection created.
Process the query result.
Close the Statement and Connection.

The JDBC operations are carried out through the “Connection”, and “Statement” objects (defined in package java.sql). However, you need not to worry about knowing the details, but merely the public methods defined in the API (Application Program Interface).
Note that there is little programming involved in using JDBC programming. You only have to specify the database-URL, write the MySQL query, and process the query result. The rest of the codes are kind of “standard JDBC program”.
Lets try to understand the sql poackage classes and others:
Driver class: The driver class for the mysql database is com.mysql.jdbc.Driver.
Connection URL: The connection URL for the mysql database is jdbc:mysql://localhost/javaexpert 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, like 3306 is the port number if you change the port number while installing Mysql to your PC and javaExpert is the database name. We may use any database, in such case, we need to replace the javaexpert with your database name.
Username: The default username for the mysql database is root.
Password: It is the password given by the user at the time of installing the mysql database. In this example, we are going to use 0000 as the password.

To Load the jar file by Setting classpath:
Temporary setting
C:angle bracket sign set classpath=c:\folder\mysql-connector-java-5.0.8-bin.jar;.;

How to set the permanent classpath?
Go to environment variable then click on new tab. In variable name write classpath and in variable value paste the path to the mysqlconnector.jar file by appending mysqlconnector.jar;.; as C:\folder\mysql-connector-java-5.0.8-bin.jar;.;

Subscribe : https://www.youtube.com/channel/UCKlVOeHT0h_dIMMp_VrjGUw

#java #mysql #database

How to Connect Java to Mysql from command line (cmd)
3.15 GEEK