MySQL Database connection in Java using Eclipse || Login page Example || English

preview_player
Показать описание
Check out this article if you have still doubt. you can copy-paste code as well

For connecting java application with the mysql database, you need to follow 5 steps to perform database connectivity.

In this example we are using MySql as the database. So we need to know following informations for the mysql database:

Connection URL: The connection URL for the mysql database is jdbc:mysql://localhost:3306/test 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 test is the database name. We may use any database, in such case, you need to replace the test with your database name.
Username: The default username for the mysql database is root.
Password: The default password for the mysql database is ""(blank).Password is given by the user at the time of installing the mysql database. In this example, we are going to use "" as the password.
Let's first create a table in the mysql database, but before creating table, we need to create database first.

create database test;
use test;
create table tblogin(UserName varchar(10),Password varchar(40));

-----------------------------------
The above example will fetch all the records of tblogin table.

Two ways to load the jar file:
set classpath
2) set classpath:
There are two ways to set the classpath:
temporary
permanent
How to set the temporary classpath
open command prompt and write:
How to set the permanent classpath

-~-~~-~~~-~~-~-
Please watch: "MySQL Database connection in java 12 using eclipse 2019"
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

So easy and clear to understand. Loved it. Thanks 😊

khushalijiyani
Автор

It was a great tutorial . Before JDBC was like hell.

traveller
Автор

Thank you for this video what I searched is exactly here

sanjai
Автор

This is a very good tutorial. I like the way you explained things, very easy to understand.  I am grateful for this video, excellent, and keep up the good work.

carvelbell
Автор

i love you work ...thank you ....you dont know what satisfaction ou gave me before durga puja holidays

souvikroy
Автор

Thankyou.. it was awesome .. understands really well

anjanajoseph
Автор

Nice, you make the whole things easier

bennychong
Автор

Very helpful and great tutorial ☺️thanks!!

notevencloseml
Автор

I don't Know If any one of you will get an error that com.mysql.jdbc.Driver is Deprecated. But If you do, then just replace com.mysql.jdbc.Driver with com.mysql.cj.jdbc.Driver. I use InteliJ IDEA and I got this Error. Hope this helps you.

ranomtech
Автор

I'm so grateful men
keep up <3

sbouribilel
Автор

i downloaded the jar file and pasted it in the place as show in the video. but the jar file is not visible in the jre system library. So i added the jar file with the help of build path->add external archieve. but it is showing error at
String sql="select * from tblogin where Username='"+user.getText()+"' and

SouravSingh-huff
Автор

This is very important when you are explaining downloaded java project in interview😂😂😂😂

nilesh
Автор

the mysql-connector.jar file is not showing in jre system lbrary

prathamkorade
Автор

Great video! Can you make video how to write some result of query into the textbox, or atleast post picture of code in comment? Thanks in advance :D

crazy_tolstoy
Автор

remember to always close the Statement and the ResultSet as well

fabiocuartas
Автор

At 4:27 when i click on Run it throws an error "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Cannot instantiate the type Runnable" . can you please help me in this.

sapnachaudhary
Автор

A lit tutorial but the audio echo made me laugh

LeviForWaifu
Автор

why i follow your step why always appear message incorrect

while my username and my password is correct
please give a solution

darkemperor
Автор

the video was good but the sound are horrible
Please don't use any auto tune

patricksemilla
Автор

When I was creating JFrame (2:36) I got a big red X and the error beside it "Failed to create the part's controls". And when I clicked on details to see the error I got What would it be?

CleoxiNhA