MySQL Database connection in Java using Eclipse || Login page Example || English
Vložit
- čas přidán 24. 01. 2018
- Check out this article if you have still doubt. you can copy-paste code as well
download mysql-connector.jar file
goo.gl/ftjWmK
if this video really helped you then you can help me out by Donatation me on PayPal paypal.me/Tarique1
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:
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: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.
To connect java application with the mysql database mysqlconnector.jar file is required to be loaded.
download the jar file mysql-connector.jar
Two ways to load the jar file:
paste the mysqlconnector.jar file in jre/lib/ext folder
set classpath
1) paste the mysqlconnector.jar file in JRE/lib/ext folder:
Download the mysqlconnector.jar file. Go to jre/lib/ext folder and paste the jar file here.
2) set classpath:
There are two ways to set the classpath:
temporary
permanent
How to set the temporary classpath
open command prompt and write:
C: 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;.;
~-~~-~~~-~~-~
Please watch: "MySQL Database connection in java 12 using eclipse 2019"
• MySQL Database connect...
~-~~-~~~-~~-~
So easy and clear to understand. Loved it. Thanks 😊
You a genius my brother
It was a great tutorial . Before JDBC was like hell.
I'm so grateful men
keep up
Thank you for this video what I searched is exactly here
i love you work ...thank you ....you dont know what satisfaction ou gave me before durga puja holidays
Thanku so much.. please share my video so that i can reach to more users
Very helpful and great tutorial ☺️thanks!!
Nice, you make the whole things easier
Thanks man..
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.
Thank you so much.. please like share and subscribe
Excelente me ha ayudado mucho
Thankyou.. it was awesome .. understands really well
Thank you so much..
thank you for sharing knowledge sir!
Most welcome.. If you have any suggestions u can suggest me..
And also don't forget to share my video..
thanks a lot. you give me a new life
Thanks so much bro
Nicely done! ^^
Thanks bro.......
remember to always close the Statement and the ResultSet as well
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
Owsm vdo...helpful..ty boss
Most welcome.. Keep supporting us
THANK YOU
much thanks it worked
Thank you so much
ty my bruda
Nice one...
You're the best
This is very important when you are explaining downloaded java project in interview😂😂😂😂
What should i do because there is no ext folder in my C:/programfiles/java/jdk 11.0.6/lib ??? Then where should i paste the mysql connector jar file???
the mysql-connector.jar file is not showing in jre system lbrary
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 Password='"+pass.getText().toString()"'";
i have the same error
i export as runnable jar file but there were not showing JOptionPane onclick login . I am using jre1.8.0_271 and jdk-15.0.1
thank you so much
A lit tutorial but the audio echo made me laugh
very helpful sir
Thankyou.. please like share and subscribe my channel
where did you get that jar file, lebowski?
Sir, I m getting incorrect username and password message dialogye everytime even I m putting the correct username and password . Why should I do ?
how can u cross out getText() 8:15 which buttons do i need to click? Never did this and dont even know what i will do but well, how to do it?
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 "java.lang.NullPointerException". What would it be?
You should have WindowsBuilder plugin in eclipse then it will work..
thanks it works
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.
tnx so much.. struggled for past 4 days.. now working.. tnx
What is the music used here?
thank u sir
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.
Sir please help I am also facing the same issue
I too got same issue
I hope you will upload videos related to JavaFX and sql
Very soon.
i have been trying for 3 days , will you please help me , that which Sql and Sqlite workbench is easy to use?
Yes I m here to help u but in return I need ur support, subscribe my channel share and like my videos...
i have already done sir. Allah bless you too sir.
whenever i learn anything from the channel and its helpful, i try to hit a like button and subscribe too.
Hi there. Thanks for creating this! I am currently using Eclipse for Enterprise and I can't seem to find the 'Windows Palette' tab. Is there any way which I can find it? Also, I would like users to login and be able to see a list of PDF files that is unique to their Username. Is that possible?
Do I have to set up the database myself so that it extracts the right PDF files for each user using the app? Appreciate your assistance!
First you have to install plugin windowBuilder to get the window palette tab inside eclipse
And for PDF that is also possible and there are many way to do the same thing.. you can create a table for mapping and you can store pdf in db as well as in folder
@@TechnicalBabaji1 Thanks for responding :) I guess I will have to create my own database to store the PDF files and then extract out the relevant ones according to each Username? Is that right? I keep getting this error message:
"Access denied for user 'root'@'localhost' (using password: NO)" --> how can I solve this?
i'm using jdk is that jar file applicable for me?
hey i have eclipse oxygen .3a so i cant find jframe file by right clicking the src folder and the .jar file cant be added in the libraries folder is it because of the ver change .
You can't find even in Oxygen 2 that is a pluging you have to add in the eclipse
Technical Babaji I dnt have the version of oxygen. 2
And i just followed ur steps but cant find jframe file and cant even load the.jar file
Technical Babaji am using the march 18 eclipse oxygen. 3
No problem find the appropriate pluging and install in your eclips.. I have installed plugin in eclipses for designing purpose.. you can also do that go to settings and click on add plugin
thanks for being so kind helping me...can give tutorials on spring rest api python languages too basic will be fine too ;)
I love you
Can you tell me what is the name of the song running in background?
I pasted my SQL connector in exe but it does not show my SQL jar in jre system library
Restart your ide it will appear..
hi, i only have java 1.8.0_144, what should i do?
No problem u can do db connection
its showing error at
String sql="select * from tblogin where Username='"+user.getText()+"' and Password='"+pass.getText().toString()"'";
software is eclicpse juno
Please paste error message here
the video was good but the sound are horrible
Please don't use any auto tune
Does this work on eclipse neon3??
becoz i was not able to find jframe
U will not get even in oxygen.. you have to add form builder plugin then u will get this in any version of eclipse
Yes it will work on neon as well
Thanku ....
do you have a tutorial on connecting mysql to JavaFx??
Sorry not this time..
How to get design tab in eclipse? Can u please tellme!
Please add plugin windowBuilder then only you will be able to do that.. Please watch my latest video their I have shown how you can do that..
how to create database
...pls sir make one video ofthat
More specifically, please show how to create one with PHPmyadmin, because I ran into this tutorial assuming I would be learning how to connect to a MySQL database that I created with the command line client.
why i follow your step why always appear message incorrect
while my username and my password is correct
please give a solution
i get the same error on and on , but i found out that it's for the password field only , and i don't know why , please if you figured out why tell me , thanks .
I did everything you showed but got "incorrect username or password" even when i typed the correct username and password
Here username ans password both are case sensitive
If u have still problem then send me database and code snapshot at tarique.rkl@gmail.com I will check.
did you get the solution if yes please reply
how did you enter the 3 example user names and passwords @5:02 ?
First create a table then insert.. there is two way to insert the data into MySQL database
1 Insert query
2 phpmyadmin panel
First way is used to insert data from application
Second way is used when you want to insert data directly into database
For the second way u have to click on insert tab of phpmyadmin then one form will appear through which you can insert data..
Thank you keep support us..
create a video for creating a mysql database
what do I must do if I want go to another Java page ?
ar 2:20 i don't have window builder option? what shall i do
This is a plugin you have to add in your ide
How insert a values to use this same techniques...
Ho
w your data base will come ?? i cant understand it?
Can you tell me the timing so that i can understand
i Saw ur video,but one thing I cannot understand, where you find "user.getText",in ur project you dont declare user as avariable or ,interface
user is the Object of EditText field I have shown lady in video watch care fully wait i will tell you the exact minute where I hv shown..
Watch from 4:10 I have set variable name user
Waiting for your reply sir...
+CSEtutorials i m here
Dear subscribers,
We had gone through your comments and lots of requests for promoting your content on our channel. So, we decided to provide you with a great opportunity to promote your own content by collaborating with us. Nothing to worry it's absolutely free of cost! Don't miss this golden chance of collaboration in a channel of 18k subscriber holder! If you're Interested then directly mail here for more details
pravat.behera45@gmail.com
Regards
Technical Babaji
czcams.com/channels/Kn7xwxBKZ_H1i6nilMsRQg.html
@@TechnicalBabaji1 mail done... PlZ check
How did u set username and password for that newly created login page
i got an error com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abcdand password is abcd' at line
how can i solve this please reply !!!!!!!!!!!
You have done sql syntax error please see the sql syntax or you can share code with me I will tell you where you did the mistake.. Thank you
@@TechnicalBabaji1 ohk where can I send you the code ?
tarique.rkl@gmail.com this is my mail id you can send here
@@TechnicalBabaji1 sure I will send the java code .
@@TechnicalBabaji1 I had send the file please check it out !!
Sir in my eclipse JFrame not found how to add JFrame? Please help
Please add plugin windowBuilder plugin in your eclipse
1:11 what is the jre folder? i don't have it
can you please tell me how can i make a table on phpmyadmin clearly
Sir how to make a address book by useing java in eclipse
I am don't have jre folder....only have JDK folder..... where paste this jar file...bro...
.getText() method doesn't show up in suggestions. only showing .getBytes()
mine is is jdk12
where should i paste because ext dont exist in lib
please do respond soon
In jdk 12 you have to import inside ide u can not add directly
@@TechnicalBabaji1 Thanks alot
jdk 11 no longer has a jre folder, where do we put the jar?
Yes u are write.. in jdk 11 we have to set path for jar file.. Thanku for asking this question
If u are using IDE then u can add by clicking on external library it will work...
class.forName not found how to fix this error
where do i paste mysql-connector.jat file if i only have a jdk file?
You will not find jre folder from java 10 onwards please watch my latest video.. I have explained there how to do
@@TechnicalBabaji1 Tell me about this video... I want to watch it....
@@TechnicalBabaji1 where is the link to the latest video please??
how you create tbllogin in testvplease tutorial
How to setup in linux Please help me?
I need help doing this. I’m getting errors
i dont have jframe....!!!!
is there anyother options...????
You can design JFrame from coding as well watch this video it will really help you czcams.com/users/edit?o=U&video_id=Wga2DHPxvEA
i solve ittttttttttttttttttttttt >> go to this link czcams.com/video/oeswfZz4IW0/video.html follow him for install jframe tool , good lock
hi i dont have JRE what should I do now
muje ek app banana h
kyaa aap ek video upload kar sakte h ke jisme app icon kese banaye and user id kese create kare like Name,birthdate....
Sure .
theme of your browser?
php my admin site not working????? how to open that site
Type of error = getText cannot be resolved or is not a field......... Pls help how solve this error
You did not explain on how to have a username and password in database.
I dont have a jre folder in my JAVA
That has been removed from java 10 onwards so please watch watch my latest videos
I need install a database server? If yes, how I'll make distribution?
Mysql oracle mongodb these are the famous database software... If u want to access database server from remote location then internet connection should be their with public ip private will not work.. and distributed database is a different concept.
@@TechnicalBabaji1 Yeah, now i can see. I'm looking for Embedded database. I can't understand why the people don't speak about them. You could make a video about them, h2, derby, sqlite... they ar too important. Thank you a lot for you awnser
My dear friend.. every database has is its own importance.. we can not compare with each other.. but the concept will be same.. Concept wise only two types of database.. schema less and schema full..
When we talk about embedded database like sqlite, It is also schema full database. Now a days every android app using their sqlite database so that they can access offline as well.. bdw thank you so much definitely I will make video on these database
@@TechnicalBabaji1 Yeah, you're right. Thank you!
@@TechnicalBabaji1 sorry for my words, my intent was make a sugestion really sorry
How to make it full screen??
Simple click on maximum option on the runtime
Class.forName("com.mysql.jdbc.Driver"); not working ??
First you have to download this driver.. and paste in jre folder..
thank you , solved :)
Woow.. I am happy for u also keep share my vdo and subscribe my channel
And connection please sir i have project submission on Monday please reply fast sir
When I put in the correct username and password its saying incorrect
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database '3306/test'
it is created in phpMyAdmin and my xampp is on.
You can see the error is syntax error. So u have to correct your syntax
@@TechnicalBabaji1 There is more to it. I have checked the syntax and it is correct (same as your tutorial) yet I am unable to establish a connection with the database. Please help.
@@TechnicalBabaji1
SELECT * FROM `tblogin`;
UserName
Password
utsav
utsgh
upu
upugh
@@utsavghosh95 send me your connection code in my Gmail tarique.rkl@gmail.com
What about mac os?
Sry man.. I m totally un aware of mac os.. I haven't use mac till now
Hello. Sir.... I wana to contact u. I m also.... A online tutor for computer science.
Dear subscribers,
We had gone through your comments and lots of requests for promoting your content on our channel. So, we decided to provide you with a great opportunity to promote your own content by collaborating with us. Nothing to worry it's absolutely free of cost! Don't miss this golden chance of collaboration in a channel of 18k subscriber holder! If you're Interested then directly mail here for more details
pravat.behera45@gmail.com
Regards
Technical Babaji
czcams.com/channels/Kn7xwxBKZ_H1i6nilMsRQg.html
@@TechnicalBabaji1 yeah... Check your mail...
Hi sir please help me to install
Bro mute the music,I would like to hear You!
Can i get source code pdf please..