Connect to mysql database using JDBC in java from command line

Описание к видео Connect to mysql database using JDBC in java from command line

#jdbc #javatomysql #javadatabaseconnectivity #howtoconnectjavatomysql #javaconnection #sqlconnection #database #databaseconnectioninjava


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;.;



Learn programming languages for beginners, in this youtube channel you will learn such technologies such as python ,Html, css , javascript, php, java & database connection. We are into programming languages training, we run our own institute by the name of Credible Academy.
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Want Learn C Programming Language? Buy C language Training
Start Learning C Language click here : https://credibleacademy.in/c-language...
Don't Wait enroll Now get discount upto : 92% off

------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

Are You looking for CORE JAVA Training ? Buy JavaExpert Training
Start Learning today by clicking this link https://credibleacademy.in/java-exper...
Unlock the hurdle of getting good command in programming, Now.


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Thanks for Watching,
Follow us on
Like Facebook Page :   / credibleacedemy  
Follow us on Instagram :  / credible_academy  
LinkedIn :   / mohsin-ahmad-0bb8085b  

Комментарии

Информация по комментариям в разработке