Connect MySQL

Here are 6 detailed video tutorial on Java connect to MySQL. In addition to performing on cosole is also guiding the implementation of the query interface. The video has a little baby voice, you open up to the speaker or headphones into offline.

Part 1: Get ready & interconnection

Download mysql-connector-java-5.1.29-bin.jar (or here)
Copy vào project, Built right click select Path / Add to Built Paht

Part 2: Select Execute Query

Part 3: Execute the query inset, update, delete

Part 4: Designing interfaces for connecting data JFrame

Part 5: Load data lên JTable

Part 6: Getting JButton perform delete events, update, add (insert)



Code:
https://github.com/nguyenvanquan7826/TUT/tree/master/ConnectDatabaseJava

43 responses on Connect MySQL

  1. Data can be displayed in the center of the table column is not?
    You can demo or tutorial showing 1 icon more 1 column in the table is not.
    such as rent hotel management san.Nguoi ks just look at the info icon is displayed while the availability or

  2. A dear!E ask :
    Just like all the database connection in Java with MySQL 6 part of a standard, but now we have to create e 1 the navigation bar above include 2 command : File và About.
    In the File commands include 2 up anymore is Open, Close và Exit.
    Len open to open and manipulate tables.
    A help with the k ak e do. at your e are great exercises which handles k code is.
    THANK YOU MUCH AK!!!!

  3. if that use the MySQL Server, the same way he always lah other only in ClassName =”com.microsoft.sqlserver.jdbc.SQLServerDriver” ha Anh ???

  4. Let me ask the owner why not add the update search function in ạ ? If it is about a few hundred lines long, then roll CHUAT search . You add the search function in that it helps me to be error nguyenvanquan7826 not ?

        1. This is because your java code. For example, after you select the id return of records, and based on the id that you select the row with id that.

  5. I do a text field to enter the code and then click the student on the search button if students found him yet, it will highlight it on the table straight to his work, then click it on him but without nguyenvanquan7826 help Kids are not sitting code without the whole morning? 🙁

    1. This alone was not clear, you try searching online for viewing offline. Ah apparently put something to the table attributes can select multiple rows at once.
      “select multi row in java table”

  6. My brother asked me how can packaging is part of the program that I write have attached database.
    thanks a…

      1. oh..thank a nhiều…thanks to him that many people in the class know how to connect the database and also learned a lot from the way his code…hope that more people like you to know the road code Cock…haha

  7. he asked me at all , when you write content updates like you used to connect the student as he thi vs database is
    Kids also rewritten update function just add on 2 column and corresponds to the connection getString vs crab nhanvien em table includes 5 then the error column:
    SqlCommand String = ” UPDATE ” + table + ” SET name = ? ,Position = ?, He so luong = ?, Basic salary = ? WHERE MANY = ?”;

    com.mysql.jdbc.exceptions.jdbc4.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 ‘vu = ‘P Giam doc’, He so luong = 3.5, Basic salary = 2500000.0 WHERE MANY = 'Nv’ at line 1

    1. This is the sql error, Your review see it make wrong Nearby, You do not have any place in the table columns or you forget where no?

  8. Their use and PGadmin NetBean,Postgres to perform this error which is so dear ?

    “com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.”

      1. oh,you say dung.Minh are using this new library right “postgresql-9.4-1204.jdbc4.jar”.But their connection is successful when it runs the Select error
        “Exception in thread “main” java.lang.NullPointerException
        at sinhvien.Connect.gdt(Connect.java:55)
        at sinhvien.Connect.main(Connect.java:67)
        Java Result: 1″
        We hope for your help !

  9. Anh oi cho em hoi vi sao khi 1 row duoc chon va click button Update thi khi do minh goi ham update() kiem tra if(setDisplayInput(true, true) tai sao khi day no lai true het co truyen true vao dau anh ??

  10. Let me ask, em muốn kết nối db với website đang chạy trên host thì làm như nào vậy, he can guide me with no sir.

  11. Oh let me ask a little ko sir, in mysql 2 £, a table containing information sv sv and provincial code, 1 Province tables contain the names of provinces and provincial code, how when you display student information, it displays the same name province

  12. Anh ơi cho em hỏi ạ . nếu em tạo 1 JFrameForm , rồi em tự tạo bảng , button, và JTextField bằng tay , thì việc cập nhật dữ liệu từ mysql lên cái JFrameForm đó cũng tương tự như anh làm à ? . thank you

  13. Chao bạn Quân. Minh đã học được rất nhiều từ Website của bạn. Bạn cho mình hỏi rằng nếu mình học về Java Swing thì có cơ hội việc làm không? Because I saw almost nobody uses Java Swing to write software both. We wish you respond to questions.

    1. Welcome, of course, have the opportunity to do, however will be less than other segments because as you say, java swing their hours at work than. If you want a better chance, you should learn java java web or android nhé.

Leave a Reply

Nguyenvanquan7826 very desirable for you to leave feedback comments, Inquiries for the post as well as the Blog. But all feedback nature because the exercises are deleted households harshly and did not respond to!