Java JDBC Tutorial - Part 12.7: Connect Java Swing GUI to MySQL - Update Database

preview_player
Показать описание

---

---

In this video we will learn how to to connect a Java GUI to a MySQL database. We will update an existing employee in the database.

---
Рекомендации по теме
Комментарии
Автор

sorry but what is the method for populateGui. Hope you can answer soon, thanks a lot!

CaptainRinoXD
Автор

Hi sir, I do not understand the Employee previousEmployee =  null; part. You mention this part is for keep track the employee but where can I see the employee data? I feel like there is nothing in the parameter. All the Error i get is NullPointerException

ojisanpass-by
Автор

What is the value of EmployeeTableModel.OBJECT_COL, please ??

lorizhuka
Автор

good evening chad for some odd reason, the populategui method throws a null pointer exception for me. i've debugged numerous times, ive done which displays the correct value.
but
(nor any of the gui textfields) just will not receive any values. any thoughts?

srstudios
Автор

I have done the exact same thing as you, copy-pasted the source code in my project but I only see the Add employee button, the new button (Update Employee) does appear on preview but doesn't appear when I run the app. am I missing a file in Eclipse or what should I do?

mny
Автор

hello chad! remember me :) i am the same person taken your udemy course of spring framework and asks you question regarding hibernate issue in intellij.. now i am learning jdbc from your tutorials every thing works perfectly fine but when updating my employee i am getting this exception..
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to Employee..
Please help me..

aamirshakil
Автор

Hi I have downloaded and tried your code and it runs perfect. however when i edit it for my own table I get an error when i click the update button. the issue is with the table.getValueAT(row, column) line inside EmployeeSearchApp. even though the column value is set to -1 it still just returns the first column in the selected row.
Any ideas what could be causing this?

Thank you for the tutorials they are great keep up the good work :D

kpdc
Автор

6 Hours and 2 Hersheys Cookies n Cremes later....i finally figured it out. ..Im using Netbeans btw...and it has a habit of creating an unmodifiable "initComponents()" method and placing em at odd places....soo...i was trying to use the TextFields before they were even initialized in the initComponents method..silly me...

srstudios
Автор

Hello sir, i'm working on a jdbc project based on your code. Still i got this error when it comes to updating database *Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to org.o7planning.tutorial.jdbc....*, the error seems to have occured in the casting part
*( .... ) table.getValueAt(row, ...TableModel.OBJECT_COL); though i did set OBJECT_COL = -1 in the table model class, I'd be very grateful if you could fix this for me, thank you very much.

dsaclass