How to Connect to MySQL Database in NetBeans IDE

Sdílet
Vložit
  • čas přidán 26. 11. 2020
  • 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
  • Věda a technologie

Komentáře • 265

  • @Yahjoiasor
    @Yahjoiasor Před 3 lety +25

    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!

    • @CodeJava
      @CodeJava  Před 3 lety +1

      Glad it was helpful!

    • @toanmolsharma
      @toanmolsharma Před 3 lety

      @@CodeJava send the link exactly in video

    • @CodeJava
      @CodeJava  Před 3 lety

      @@toanmolsharma what link do you mean?

    • @toanmolsharma
      @toanmolsharma Před 3 lety

      @@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

  • @Depogramming
    @Depogramming Před rokem

    Thanks man , I have spent like 4 hours searching on how to connect database and netbeans ,
    you saved my GPA

  • @kwandokuhlemhlongo4676
    @kwandokuhlemhlongo4676 Před 2 lety +3

    Man, thank you for sharing this. If it weren't for this video, I would've failed my assignment. I appreciate you.

  • @devashishathawale4807
    @devashishathawale4807 Před 2 lety +2

    Thank you so much, our school textbooks don't help us much at all, this one video helped me solve the problem!

    • @CodeJava
      @CodeJava  Před 2 lety +1

      Glad it helped.

    • @CoollBoyz-dr5nv
      @CoollBoyz-dr5nv Před 2 lety

      Bhai main ye pg main padh raha hun aur tu school main 🥲

  • @antrung9908
    @antrung9908 Před 3 lety +6

    Thank you so much! This video is very good

  • @biancapxt
    @biancapxt Před 3 lety

    THANK YOU!!!! I was looking for a solution for hours

  • @pavithramarimuthu2616
    @pavithramarimuthu2616 Před 2 lety +2

    Thanks a lot . really helped me a lot. I was searching for videos and finally found ur clear video and clear guidance
    .

    • @CodeJava
      @CodeJava  Před 2 lety

      Glad it helped

    • @aryanshah1938
      @aryanshah1938 Před 2 lety

      It keeps on showing connection failed, how did you solve that. I tried everything

  • @nourelhouda5251
    @nourelhouda5251 Před 2 lety

    Thank you soo much !! i was looking for this for months !!!

  • @simba4513
    @simba4513 Před 3 lety +2

    thank you so much!!! finally I solved it!

  • @DeepakKumar-rv9di
    @DeepakKumar-rv9di Před 2 lety

    You saved me, Bro!! Thank you so much.

  • @RahulSingh-yz7jd
    @RahulSingh-yz7jd Před 2 lety

    Thank you so much. I couldn't get my task done and you helped me soo much thank you again.

  • @mer0925
    @mer0925 Před 3 lety +2

    Thank you very much, now i can finish my project

  • @whatshouldido805
    @whatshouldido805 Před 3 lety

    IT WORKED!!!!!! Thank you so much.

  • @tamnguyenthanh1694
    @tamnguyenthanh1694 Před 2 lety

    Thank you so much, I lose a night to research but no result but in your video I've resolved my problem

  • @ngophuocloc5030
    @ngophuocloc5030 Před 2 lety

    Thanks u =)) after 3 days finally i can connect MySQL with this video =))

    • @CodeJava
      @CodeJava  Před 2 lety

      Glad I could help!

    • @ola6495
      @ola6495 Před rokem

      third week and i have not connect it yet

  • @divinaviolet3397
    @divinaviolet3397 Před 2 lety

    Thank u so much....after many videos finally this worked

  • @leandropoma9865
    @leandropoma9865 Před 2 lety

    Thanks!!!, Greetings from Bolivia

  • @nathansuarez5543
    @nathansuarez5543 Před 3 lety +5

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

  • @thenatureedits8089
    @thenatureedits8089 Před 3 lety

    Helped very much, thanks

  • @efromthestudio
    @efromthestudio Před 2 lety

    this helped me a lot thank you!!

  • @analys7622
    @analys7622 Před 2 lety +1

    Hay quá anh :awesome:

  • @PoojaSingh-ig8ki
    @PoojaSingh-ig8ki Před 3 lety +1

    you explained it very well....thank u

  • @anhtram4181
    @anhtram4181 Před 3 lety

    Thanks man. It's work!!!

  • @jessadelacruz2079
    @jessadelacruz2079 Před 3 lety

    So great!! Thanks!!

  • @yudhanjeffri9433
    @yudhanjeffri9433 Před 3 lety

    thank you so much, you save my day

  • @luarcapancho
    @luarcapancho Před 3 lety +2

    Thanks it was very helpfull

  • @dejandjosic1258
    @dejandjosic1258 Před 2 lety

    Very helpful. Thank you

  • @josephoduor2358
    @josephoduor2358 Před 2 lety

    Thank you for this.

  • @sanjayanuwan42
    @sanjayanuwan42 Před 2 lety

    CEO of "here"

  • @parthshah7201
    @parthshah7201 Před 3 lety +1

    Thanks for this video

  • @moon_boss123
    @moon_boss123 Před 3 lety

    thanks a lot ...a now i can do my task's.....

  • @Nscb1947
    @Nscb1947 Před 3 lety

    helped a lot thanks

  • @nikeshchannel9730
    @nikeshchannel9730 Před 3 lety

    Thank you soo much Brother

  • @FlamingSteed
    @FlamingSteed Před 2 lety +1

    Awesome

  • @jorgeescoto2382
    @jorgeescoto2382 Před 2 lety +1

    Great content

  • @chin_dev7701
    @chin_dev7701 Před 2 lety

    thank you so much it is great

  • @nguyenhoan8532
    @nguyenhoan8532 Před 3 lety +5

    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 :(

  • @frauschwer9197
    @frauschwer9197 Před 2 lety

    Thanks a lot bro

  • @who_thekaushik
    @who_thekaushik Před 2 lety

    thanks a lot fot the help

  • @alexismontales7731
    @alexismontales7731 Před 2 lety

    thanks man!

  • @blasiusjohn7204
    @blasiusjohn7204 Před 3 lety

    Good man, tanx

  • @soniasanmiguel7197
    @soniasanmiguel7197 Před 3 lety

    Excellent

  • @codedrian
    @codedrian Před 3 lety +3

    I got this error Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL using com. What should I do?

  • @oasteadomnuluibucovina

    the best

  • @cameraman9906
    @cameraman9906 Před 2 lety

    Thank you dear

  • @picaohg7370
    @picaohg7370 Před 3 lety

    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?

    • @CodeJava
      @CodeJava  Před 3 lety

      then you need to write Java code. Check this video: czcams.com/video/duEkh8ZsFGs/video.html

  • @VIKASSHARMA-ic3dm
    @VIKASSHARMA-ic3dm Před rokem

    thanks bro

  • @alevilghost
    @alevilghost Před 3 lety

    Que genial, muchas gracias.

  • @benahmbugua5518
    @benahmbugua5518 Před 2 lety

    thanks alot

  • @codedrian
    @codedrian Před 3 lety

    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.

    • @CodeJava
      @CodeJava  Před 3 lety

      add what to system variable?

  • @toprakarat1018
    @toprakarat1018 Před 3 lety

    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.

    • @CodeJava
      @CodeJava  Před 3 lety

      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;

  • @yiamkarkar5240
    @yiamkarkar5240 Před 3 lety +1

    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

    • @CodeJava
      @CodeJava  Před 3 lety

      which version of your MySQL JDBC driver, 5.1. or 8.0? The latest one will not have time zone issue.

    • @yiamkarkar5240
      @yiamkarkar5240 Před 3 lety

      @@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!

    • @blackiethecat8
      @blackiethecat8 Před 3 lety

      @@yiamkarkar5240 how did you solve this problem? i got this error too

    • @yiamkarkar5240
      @yiamkarkar5240 Před 3 lety

      @@blackiethecat8 by specifying the server time zone in the database url, for example: "jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=convert_To_Null&serverTimezone=UTC"

    • @picaohg7370
      @picaohg7370 Před 3 lety

      @@yiamkarkar5240 replace to ?useTimezone=true&serverTimezone=UTC this "?zeroDateTimeBehavior=convert_To_Null&serverTimezone=UTC""

  • @ozonewagle
    @ozonewagle Před 2 lety +1

    Do i need to run xamp & mysql service in background for it to work?

    • @CodeJava
      @CodeJava  Před 2 lety +1

      yes, you do have MySQL service running in background, on localhost or on other machine.

    • @emito69
      @emito69 Před rokem

      @@CodeJava and is there a way to make the connection using a SQL Service from netbeans? without the need of xampp or mysqlservice?

    • @CodeJava
      @CodeJava  Před rokem +1

      @@emito69 no way. NetBeans is just an IDE.

    • @emito69
      @emito69 Před rokem +1

      @@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!

    • @CodeJava
      @CodeJava  Před rokem +1

      @@emito69 that's right. check my video: czcams.com/video/HsxUlODSvfM/video.html

  • @priyanshusingh1075
    @priyanshusingh1075 Před 2 lety

    in which version u made this project is there any difference in new versions of netbeans and jdbc

    • @CodeJava
      @CodeJava  Před 2 lety

      I was using NetBeans 12.1 - there might be difference in the new version, but I think it would be similar.

  • @jamalelboujamai1927
    @jamalelboujamai1927 Před 3 lety +1

    tnx

  • @totallyrandom9063
    @totallyrandom9063 Před 3 lety

    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

  • @kshitij5827
    @kshitij5827 Před 2 lety

    thanks

  • @barsaraneebarik4141
    @barsaraneebarik4141 Před rokem

    If we connect database with service can we access it every frame and no code required for writing?

    • @CodeJava
      @CodeJava  Před rokem

      No, you still need to write code in your Java project. Check this video: czcams.com/video/duEkh8ZsFGs/video.html

  • @frandychacon7505
    @frandychacon7505 Před 3 lety

    is it the same on Netbeans IDE 8.2? I can't see any database icon on mine

    • @CodeJava
      @CodeJava  Před 3 lety

      I don't know because I no longer use NB 8, which is too old. Upgrade to Apache NetBeans 12.

    • @riyapatil311
      @riyapatil311 Před 3 lety +1

      Maybe you'll see library then add library you will get options to add mysql

  • @arafatlone1162
    @arafatlone1162 Před 3 lety

    I got an error for Cannot establish a connection to jdbc
    Do i need to have an SQL ?

    • @CodeJava
      @CodeJava  Před 3 lety +1

      Sure, you need to have MySQL server running locally on your computer or remotely on another computer.

  • @belahouelmohammedmehdi9687

    I have a little problem when i test connection it dosent succed any ideas??

    • @CodeJava
      @CodeJava  Před 2 lety +1

      check JDBC URL, database username, password, port number, schema name... Make sure MySQL server is running.

  • @PriyanshuYadav-bq8py
    @PriyanshuYadav-bq8py Před 2 lety +1

    I think Ravi kumar is your indian friend 😂

    • @CodeJava
      @CodeJava  Před 2 lety

      haha, is it a common Indian name?

  • @monikashira4611
    @monikashira4611 Před 3 lety +1

    Sir after adding mysql connector it show same error in connection of driver what I can do

  • @austinmumba1803
    @austinmumba1803 Před 2 lety

    Had you created the database already prior to connection?

  • @elestirensincap1481
    @elestirensincap1481 Před 3 lety

    Hello. For some reason, the Localhost section did not appear for me, what should I do? 3:32

  • @ishaanapte6570
    @ishaanapte6570 Před 2 lety

    but bow to add data into the database from java class
    since i am making GUI

    • @CodeJava
      @CodeJava  Před 2 lety

      follow this video: czcams.com/video/1pA64-foiz8/video.html

  • @ayushenma
    @ayushenma Před rokem

    it says my table does not exist after insert data 9:25

  • @enriquezpastunafranklingeo5960

    hola tengo error al momento de realizar la prueba de coneccion ayúdame please

    • @CodeJava
      @CodeJava  Před 3 lety

      Ensure that url, username and password are correct. Also MySQL server instance is running.

  • @ashinkunjumon3295
    @ashinkunjumon3295 Před 3 lety

    For me its showing invalid and not connecting to server

  • @pmcrevenant1297
    @pmcrevenant1297 Před rokem

    Strangely... I can't connect because mine kept saying "Connection Failed" what did I do wrong?!

    • @CodeJava
      @CodeJava  Před rokem

      check JDBC url, username, password and make sure the MySQL server is up.

    • @pmcrevenant1297
      @pmcrevenant1297 Před rokem

      @@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".

  • @pooranasundarpooranasundar9864

    I tried to connect the Database, But it's showing Connection failed. Can you explain how to resolve this ?

    • @CodeJava
      @CodeJava  Před 2 lety

      That error means one of connection information is incorrect. So check JDBC URL, username, password. Also make sure MySQL server is running.

  • @shauntiey
    @shauntiey Před 9 měsíci

    My netbeans doesn't show the option to create a new connection?

    • @CodeJava
      @CodeJava  Před 9 měsíci +1

      I don't know why. Perhaps your NB installation is corrupted. Try to remove and install again.

  • @m1das_
    @m1das_ Před 2 lety

    please, next time attach links in the description which you used in the video

    • @CodeJava
      @CodeJava  Před 2 lety

      ok, thanks for watching :)

  • @manhnguyen-kc2pi
    @manhnguyen-kc2pi Před 2 lety

    a đang ở vn hay ở đâu vậy ạ

  • @gustimuhammadaulianursulth7192

    how about when test connection errorr?

    • @CodeJava
      @CodeJava  Před 3 lety

      then check username, password, JDBC URL... also ensure MySQL server is running

  • @ganeshmalo7736
    @ganeshmalo7736 Před 2 lety

    I can not connect mysql with netbeans ,Any password can i use?

    • @CodeJava
      @CodeJava  Před 2 lety

      it must be the password you set when installing MySQL.

  • @anjalivalani69
    @anjalivalani69 Před 9 měsíci

    Hey beo i am still getting error like connection failed😢

    • @CodeJava
      @CodeJava  Před 9 měsíci

      check JDBC URL, username, password.... also make sure MySQL server is actually running.

  • @nongvunguyen1621
    @nongvunguyen1621 Před 2 lety

    what password of root can i fill out
    i have some problem with this

    • @CodeJava
      @CodeJava  Před 2 lety

      then you have to reset your root password. reference: stackoverflow.com/questions/16556497/mysql-how-to-reset-or-change-the-mysql-root-password

  • @ThuyHoang-di4hs
    @ThuyHoang-di4hs Před 2 lety

    anh oi nêu e cài mà nó k thành cong là lỗi do đâu vậy ạ

    • @CodeJava
      @CodeJava  Před 2 lety +1

      kiểm tra JDBC driver, JDBC URL, username và password.

    • @ThuyHoang-di4hs
      @ThuyHoang-di4hs Před 2 lety

      @@CodeJava anh oi anh cho e xin inf đi ạ, em thử mãi không được anh ạ

  • @rameshwarsuryawanshi8468

    Sir I have problem to connecting to databases

    • @CodeJava
      @CodeJava  Před 3 lety +1

      do you know what the error ?

  • @vednande6192
    @vednande6192 Před 2 lety

    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.

    • @CodeJava
      @CodeJava  Před 2 lety

      make sure that mysql server is up and running.

    • @vednande6192
      @vednande6192 Před 2 lety +1

      @@CodeJava actually I again installed Java 17 now everything is right.. thanks a lot 🙏😊

  • @Lelouchvv
    @Lelouchvv Před 2 lety +1

    giong giong VN ghe

  • @yazhilanj4416
    @yazhilanj4416 Před 3 lety

    Sir it says cannot establish a connection

    • @CodeJava
      @CodeJava  Před 3 lety

      Check JDBC URL, username, password, port number... make sure everything is correct. Also checking MySQL instance is running. If connect remotely, check firewall.

  • @hatran_fitness
    @hatran_fitness Před 3 lety +1

    Are you Vietnamese?

  • @PRIYADHARSHINI-dl7vm
    @PRIYADHARSHINI-dl7vm Před 3 lety

    I can't add the connector file

    • @CodeJava
      @CodeJava  Před 3 lety

      why? is there any error?

    • @PRIYADHARSHINI-dl7vm
      @PRIYADHARSHINI-dl7vm Před 3 lety +1

      @@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

  • @JohnMichaelRRoma
    @JohnMichaelRRoma Před 2 lety

    what to do if connection failed :(

    • @CodeJava
      @CodeJava  Před 2 lety

      so check JDBC URL, username, password. And make sure MySQL server is running.

  • @millioner7391
    @millioner7391 Před 2 lety

    Connection failed: Access denied for user 'root'@'localhost' (using password: YES) (jdbc:mysql
    what to do

    • @CodeJava
      @CodeJava  Před 2 lety

      check username and password - either is incorrect.

  • @user-ok3wp1nv3m
    @user-ok3wp1nv3m Před 3 lety

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

  • @nisa5947
    @nisa5947 Před 3 lety

    how do I know the correct password?

    • @CodeJava
      @CodeJava  Před 3 lety +1

      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

  • @mouse6228
    @mouse6228 Před 3 lety

    I cannot establish a connection

    • @CodeJava
      @CodeJava  Před 3 lety

      what is the error message? Check host name, post number, username, password, database name...

    • @user-mt2wl
      @user-mt2wl Před 3 lety +3

      @@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.)

    • @annupandey841
      @annupandey841 Před 3 lety +1

      @@user-mt2wl how can i solve this error?

    • @user-mt2wl
      @user-mt2wl Před 3 lety

      I resolude this problem juste to download the last version of apache netbeans

  • @swathinunavth8646
    @swathinunavth8646 Před 3 lety

    Password is not working can you help with it

    • @CodeJava
      @CodeJava  Před 3 lety

      so you must use the correct password.

    • @nisa5947
      @nisa5947 Před 3 lety

      @@CodeJava how do I know the correct password?

  • @zdani3
    @zdani3 Před 7 měsíci

    szarabb gép nem volt kéznél?

  • @lloyde3202
    @lloyde3202 Před 2 lety

    My connection failed

    • @CodeJava
      @CodeJava  Před 2 lety

      check url, username, password and make sure the server is running.

  • @yoyo-ct3sh
    @yoyo-ct3sh Před 2 lety

    audio not clear

  • @djemilasandza
    @djemilasandza Před 3 lety

    Entered root password but shows error

    • @CodeJava
      @CodeJava  Před 3 lety

      what is the error? check carefully username, password, port number, ... and make sure that MySQL server is actually running.

    • @djemilasandza
      @djemilasandza Před 3 lety

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

  • @alejandromattias7663
    @alejandromattias7663 Před 3 lety

    this solution does not work for me

  • @rahmamedhat910
    @rahmamedhat910 Před 2 lety

    Please, what is password, is this constant word?

    • @CodeJava
      @CodeJava  Před 2 lety +1

      No, it is the password you set when MySQL is installed.

  • @rajanemani
    @rajanemani Před 2 lety

    COMPILATION ERROR :
    -------------------------------------------------------------
    hospital/editPatient.java:[53,72] error while writing : could not create parent directories
    1 error getting this error

    • @rajanemani
      @rajanemani Před 2 lety

      can you plz help me ?

    • @CodeJava
      @CodeJava  Před 2 lety

      maybe your application doesn't have permission to write files (create parent directories).

  • @BroStartup
    @BroStartup Před rokem

    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.

    • @CodeJava
      @CodeJava  Před rokem

      I think it's version compatibility or bug of the driver. Thanks for the tip.

    • @BroStartup
      @BroStartup Před rokem

      @@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

  • @salmali9039
    @salmali9039 Před rokem

    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)

    • @CodeJava
      @CodeJava  Před rokem

      MySQL server might be not running. Check for that.

    • @thanuja9912
      @thanuja9912 Před rokem

      Is your error solved