How to Connect to MySQL Database in NetBeans IDE
HTML-код
- Опубликовано: 5 сен 2024
- In this video I'd like to share with you how to connect to MySQL database in NetBeans IDE using Database Services tool, so you can work with and manage MySQL databases right inside NetBeans without having to use an external program like MySQL Workbench or MySQL Command Line Client.
In details, you will learn:
- Download MySQL JDBC driver
- Make connection to a MySQL database
- Create a new table
- Update data in a table
- Execute SQL statements
And I suppose that you're using these software programs:
- Java Development Kit (JDK)
- Apache NetBeans IDE
- MySQL Community server
I really appreciate someone who share his knowledge to help other people. specially me who is in the process of learning. Thank you so much!
Glad it was helpful!
@@CodeJava send the link exactly in video
@@toanmolsharma what link do you mean?
@@CodeJava the java connector file in netbeams library class does not appear meanwhile i created backend data through phpmyadmin i want to connect databse to my java project
Thank you so much, our school textbooks don't help us much at all, this one video helped me solve the problem!
Glad it helped.
Bhai main ye pg main padh raha hun aur tu school main 🥲
Man, thank you for sharing this. If it weren't for this video, I would've failed my assignment. I appreciate you.
Glad it helped!
Thanks man , I have spent like 4 hours searching on how to connect database and netbeans ,
you saved my GPA
Glad I could help
when i click test connection on 4:56 i get this error (Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL using com.mysql.cj.jdbc.Driver (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.))
were you able to fix it?
I'm getting the same error
I am getting same error you know how to fix it?
Thank you so much, I lose a night to research but no result but in your video I've resolved my problem
Glad it helped
I had succeeded the first time I tried thism very helpful thank you. But a few days later when I try to do it again it showed this problem(Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL using com.mysql.cj.jdbc.Driver (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.) and I dont know how to fix it, please help :(
Did u fixed it?
Thanks a lot . really helped me a lot. I was searching for videos and finally found ur clear video and clear guidance
.
Glad it helped
It keeps on showing connection failed, how did you solve that. I tried everything
Thank you very much, now i can finish my project
You are welcome
Thanks!!!, Greetings from Bolivia
Welcome!
Thanks u =)) after 3 days finally i can connect MySQL with this video =))
Glad I could help!
third week and i have not connect it yet
Thank u so much....after many videos finally this worked
You're welcome!
you explained it very well....thank u
You are welcome :)
Thank you so much. I couldn't get my task done and you helped me soo much thank you again.
Glad I could help!
CEO of "here"
Happy to help!
Thanks it was very helpfull
You're welcome!
Thank you so much! This video is very good
You're so welcome!
I got this error Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL using com. What should I do?
kyuki mera bhi nhi hua
THANK YOU!!!! I was looking for a solution for hours
You are welcome!
thank you so much!!! finally I solved it!
You're welcome!
Great content
thank you!
Thank you soo much !! i was looking for this for months !!!
Glad it helped!
Very helpful. Thank you
You're welcome!
Thanks for this video
No problem
You saved me, Bro!! Thank you so much.
You are welcome!
IT WORKED!!!!!! Thank you so much.
You're welcome!
Awesome
thanks a lot ...a now i can do my task's.....
Happy to help
this helped me a lot thank you!!
Glad it helped!
thanks a lot fot the help
You're welcome!
thank you so much, you save my day
You're welcome!
Thank you soo much Brother
Most welcome
thank you so much it is great
You're welcome 😊
Thank you for this.
My pleasure!
I have a little problem when i test connection it dosent succed any ideas??
check JDBC URL, database username, password, port number, schema name... Make sure MySQL server is running.
Do i need to run xamp & mysql service in background for it to work?
yes, you do have MySQL service running in background, on localhost or on other machine.
@@CodeJava and is there a way to make the connection using a SQL Service from netbeans? without the need of xampp or mysqlservice?
@@emito69 no way. NetBeans is just an IDE.
@@CodeJava thanks. i undestand now. i found that there are db servers like H2 that i can embbed in my aplication. i will keep learning. greats!
@@emito69 that's right. check my video: ruclips.net/video/HsxUlODSvfM/видео.html
Sir after adding mysql connector it show same error in connection of driver what I can do
what is the error?
@@CodeJava com.mysql.jdbc.Driver
This is the error sir
Thanks a lot bro
Always welcome
how i can pull the connection to an jframe archive to send the text field information? i do not know how to pull the connection or this way of service link is only for this purpouses?
then you need to write Java code. Check this video: ruclips.net/video/duEkh8ZsFGs/видео.html
thanks bro
Welcome
the best
thanks.
Excellent
Thank you so much 😀
Hay quá anh :awesome:
helped a lot thanks
You're welcome!
Thank you dear
Welcome 😊
thanks alot
You are welcome 😁
So great!! Thanks!!
You're welcome!
If we connect database with service can we access it every frame and no code required for writing?
No, you still need to write code in your Java project. Check this video: ruclips.net/video/duEkh8ZsFGs/видео.html
Thanks man. It's work!!!
You're welcome!
Hi, I got an error "The server time zone value 'Malay Peninsula Standard Time' is unrecognized or represents more than one time zone. You must configure either..." when trying to connect the server, is there any solutions to solve this problem? I'm using the exactly same version of MySQL and Netbeans as yours
which version of your MySQL JDBC driver, 5.1. or 8.0? The latest one will not have time zone issue.
@@CodeJava I'm using MySQL JDBC driver version 8.0.22. By the way, I already got the solution to solve this problem. Thanks for your reply!
@@yiamkarkar5240 how did you solve this problem? i got this error too
@@blackiethecat8 by specifying the server time zone in the database url, for example: "jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=convert_To_Null&serverTimezone=UTC"
@@yiamkarkar5240 replace to ?useTimezone=true&serverTimezone=UTC this "?zeroDateTimeBehavior=convert_To_Null&serverTimezone=UTC""
it says my table does not exist after insert data 9:25
in which version u made this project is there any difference in new versions of netbeans and jdbc
I was using NetBeans 12.1 - there might be difference in the new version, but I think it would be similar.
Strangely... I can't connect because mine kept saying "Connection Failed" what did I do wrong?!
check JDBC url, username, password and make sure the MySQL server is up.
@@CodeJava Where can I check this JDBC? And how can I check if my MySQL server is up? It doesn't even highlight the "Start Server".
but bow to add data into the database from java class
since i am making GUI
follow this video: ruclips.net/video/1pA64-foiz8/видео.html
I use Microsoft SQL Server Managament and my authentication is Windows Authentication. So, what should i write on host name, port and Username? I dont have it.
with Windows authentication, you don't have to specify username and password. Just specify the JDBC URL like this:
jdbc:sqlserver://localhost:1433;databaseName=testdb;integratedSecurity=true;
this message is showing when i tried to make a new connection? Cannot establish a connection to jdbc:mysql://localhost:3306/mysqltest?zeroDateTimeBehavior=CONVERT_TO_NUL
My netbeans doesn't show the option to create a new connection?
I don't know why. Perhaps your NB installation is corrupted. Try to remove and install again.
For me its showing invalid and not connecting to server
Hi. Is it okay that I don't add them in my System variable? I saw some tutorials that they add them in their system variable. Thank you.
add what to system variable?
I got an error for Cannot establish a connection to jdbc
Do i need to have an SQL ?
Sure, you need to have MySQL server running locally on your computer or remotely on another computer.
Good man, tanx
You're welcome!
thanks man!
Happy to help!
I tried to connect the Database, But it's showing Connection failed. Can you explain how to resolve this ?
That error means one of connection information is incorrect. So check JDBC URL, username, password. Also make sure MySQL server is running.
I think Ravi kumar is your indian friend 😂
haha, is it a common Indian name?
thanks
You're welcome!
Hey beo i am still getting error like connection failed😢
check JDBC URL, username, password.... also make sure MySQL server is actually running.
Hello. For some reason, the Localhost section did not appear for me, what should I do? 3:32
Thanks, I just fixed the problem. I forgot to register :D
Glad to know that.
Connection failed: Access denied for user 'root'@'localhost' (using password: YES) (jdbc:mysql
what to do
check username and password - either is incorrect.
tnx
you're welcome :)
i am getting an error when am following the same process Selected mysql-connector-j-8.0.31.jar might cause unexpected problems. Use preferred mysql-connector-java-8.0.17.jar.
I think it's version compatibility or bug of the driver. Thanks for the tip.
@@CodeJava Thanks for the tip. But i can resolve the issue. the problem is different. Actually i working with xampp. Mysql is not started from there i am trying to change the name of user from root to diffrent so that''s way i am getting that error
Had you created the database already prior to connection?
Yes, suppose that you have some existing databases.
@@CodeJava Thanks man!
is it the same on Netbeans IDE 8.2? I can't see any database icon on mine
I don't know because I no longer use NB 8, which is too old. Upgrade to Apache NetBeans 12.
Maybe you'll see library then add library you will get options to add mysql
I can not connect mysql with netbeans ,Any password can i use?
it must be the password you set when installing MySQL.
how about when test connection errorr?
then check username, password, JDBC URL... also ensure MySQL server is running
please, next time attach links in the description which you used in the video
ok, thanks for watching :)
what to do if connection failed :(
so check JDBC URL, username, password. And make sure MySQL server is running.
It is showing me this error.. please help Connection failed: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago.
make sure that mysql server is up and running.
@@CodeJava actually I again installed Java 17 now everything is right.. thanks a lot 🙏😊
what password of root can i fill out
i have some problem with this
then you have to reset your root password. reference: stackoverflow.com/questions/16556497/mysql-how-to-reset-or-change-the-mysql-root-password
Sir I have problem to connecting to databases
do you know what the error ?
Sir it says cannot establish a connection
Check JDBC URL, username, password, port number... make sure everything is correct. Also checking MySQL instance is running. If connect remotely, check firewall.
hola tengo error al momento de realizar la prueba de coneccion ayúdame please
Ensure that url, username and password are correct. Also MySQL server instance is running.
a đang ở vn hay ở đâu vậy ạ
VN em.
Are you Vietnamese?
yes, I am.
how I can solve this problem?
Cannot establish a connection to jdbc:mysql://localhost:3306/userdb using com.mysql.jdbc.Driver (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
COMPILATION ERROR :
-------------------------------------------------------------
hospital/editPatient.java:[53,72] error while writing : could not create parent directories
1 error getting this error
can you plz help me ?
maybe your application doesn't have permission to write files (create parent directories).
anh oi nêu e cài mà nó k thành cong là lỗi do đâu vậy ạ
kiểm tra JDBC driver, JDBC URL, username và password.
@@CodeJava anh oi anh cho e xin inf đi ạ, em thử mãi không được anh ạ
I can't add the connector file
why? is there any error?
@@CodeJava noo its my error i didn't do it properly... now i got it thank you very much.... i even completed my project thank you thanks a lot
My connection failed
check url, username, password and make sure the server is running.
this solution does not work for me
what issue did you get?
Que genial, muchas gracias.
you're welcome.
giong giong VN ghe
yes, I'm from Vietnam
ghê cái j ông cũng biết
@@duonghiep545 :))))
Please, what is password, is this constant word?
No, it is the password you set when MySQL is installed.
how do I know the correct password?
You can't know once you forgot. The only way is to reset the root password. Reference: dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/resetting-permissions-windows.html
audio not clear
Sorry to hear that.
Entered root password but shows error
what is the error? check carefully username, password, port number, ... and make sure that MySQL server is actually running.
The problem is it my own password that if have to put cause it doesn’t work. When I’m testing the connection it says that “Cannot establish a connection to jdbc...
Password is not working can you help with it
so you must use the correct password.
@@CodeJava how do I know the correct password?
I cannot establish a connection
what is the error message? Check host name, post number, username, password, database name...
@@CodeJava Cannot establish a connection to jdbc:mysql://localhost:3306/grosappareils?zeroDateTimeBehavior=CONVERT_TO_NULL using com.mysql.cj.jdbc.Driver (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
@@user-mt2wl how can i solve this error?
I resolude this problem juste to download the last version of apache netbeans
szarabb gép nem volt kéznél?
what's the solation of this problem ? Connection failed: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (jdbc:mysql://localhost:3306/newdb?zeroDateTimeBehavior=CONVERT_TO_NULL using com.mysql.cj.jdbc.Driver)
MySQL server might be not running. Check for that.
Is your error solved
Connection failed: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL using com.mysql.cj.jdbc.Driver)
Is your error solved?