How to Get Data from Database to JTable in Java | Display MySQL Data into JTable

  Рет қаралды 69,218

CS CORNER Sunita Rai

CS CORNER Sunita Rai

Күн бұрын

Пікірлер: 161
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
*_Got a question on the topic? Please share it in the comment section below and I will answer it for you._*
@iamnel3141
@iamnel3141 Жыл бұрын
My codes didn't show anything 😢
@sadokfkaier7703
@sadokfkaier7703 10 ай бұрын
Same think happened @@iamnel3141
@7_ajinkya
@7_ajinkya 2 жыл бұрын
so far the only video that shows how to work with JTable and ScrollPane! Thank you so much!!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad to know👍Keep watching
@swanandlaghate5113
@swanandlaghate5113 Жыл бұрын
Thanks a lot!!!! You have just cleared my 2.5 years long confussion!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 11 ай бұрын
You're welcome👍 please subscribe
@preciousjumuad2958
@preciousjumuad2958 2 жыл бұрын
Thank you ma'am! You just saved me from being stuck in a bug for a whole week. May you continue helping programmers, kudos!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad it helped! Yes, I will.
@adramshapath4720
@adramshapath4720 Ай бұрын
Madam Excellent Performance with great detail
@dannydevelops
@dannydevelops Жыл бұрын
You deserve a medal for this. Thanks
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Thank you ☺😊please subscribe
@SimplySuman
@SimplySuman 2 жыл бұрын
So clearly explained ma'am 🙏
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so much👍
@MessiSwag10
@MessiSwag10 Жыл бұрын
Thank you so much for the helpful video! I do have a question though. In your program, you knew the amount of columns before hand, so you were able to create the no, name, and makrs variables. Is there an alternate way to do this if you don't know what your column size will be?
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Yes you can use ResultSetMetaData interface. It's having method through which you can get column count.
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Refer my advanced java playlist. I have shown in one video
@IonianWinds
@IonianWinds Жыл бұрын
you are an absolute lifesaver!! Thank you so much for sharing this! Wish you very happy holidays and an amazing new year! 💞
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
That's great😊 keep watching and plz subscribe
@definitelynotamexicanskele6913
@definitelynotamexicanskele6913 Жыл бұрын
Thank you so much maam, you're a life saver!!!
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Happy to help!plz subscribe
@robmanda007
@robmanda007 2 жыл бұрын
Hi how are you, Thank you so much for the these tutorials. They are so helpful in my capstone project. May you please do lectures on how to create pie charts, bar graphs and line graphs fetching data from a database.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad my video helped you👍 I'll try
@devisri7645
@devisri7645 2 жыл бұрын
Thank you for clear demo mam
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍
@joelmarkjmj
@joelmarkjmj Жыл бұрын
OMG Mam you saved me!
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
You're welcome👍please subscribe😊
@theamazingtutorial.9019
@theamazingtutorial.9019 Жыл бұрын
Easy Explained. This video made my knowledge++. Thank you
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Wowww that's great 👍😊🔥keep watching
@amitdlh
@amitdlh Жыл бұрын
hello , please how can i solve this problem when I run i get : java.sql.SQLException: No value specified for parameter 1 ! thankyou .
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Check out no, of? And r u providing value for all these ? Or not
@festussibanda5886
@festussibanda5886 2 жыл бұрын
thank you so much, your video just helped me learn a new concept, keep up the good work
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad to hear that! Keep watching and plz subscribe
@AbdessamadBelm
@AbdessamadBelm Жыл бұрын
Great video , straight to the point. Thank you so much 👍
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Glad you liked it👍☺plz subscribe
@SHEIMANALEKZANDAR
@SHEIMANALEKZANDAR Жыл бұрын
Hi ma'am May i know how do view table without clicking a button! Like an Example when i run the program automatically The records from the database should show
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Write code in constructor
@bonissocool4638
@bonissocool4638 2 жыл бұрын
Thank you so useful for my uni project!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad to know that👍 stay connected✅
@zeronetechlearner1546
@zeronetechlearner1546 2 жыл бұрын
Thanks a million, Madam.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍 Do explore my channel for such more contents
@health.upgradedbyscience.7309
@health.upgradedbyscience.7309 2 жыл бұрын
Great tutorial, thanks a lot! It´s of tremendous help for what I´m working on right now..
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad my video helped you👍 keep watching😍
@arifhussain9676
@arifhussain9676 2 жыл бұрын
THanks for the video, every time i press show button, It makes duplicate and show it on table. Can we do something so that no duplicate record shows on table
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Check addRow method. Did you wrote it twice?
@arifhussain9676
@arifhussain9676 2 жыл бұрын
@@CSCORNERSunitaRai I wrote it one time but I press button twice or when you press button again and again, you get duplicate rows.
@robert2001101
@robert2001101 11 ай бұрын
Thank you for the helpful code tutorial. I'm having an issue with the column names not displaying properly though, they only show java.lang.String or java.lang.Integer. Could you help me with this please?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 11 ай бұрын
Check lines again given in my video
@hoangngochieu17
@hoangngochieu17 Жыл бұрын
Could you tell me why I can't run JinternalFrame after extending it...
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Do u hv main method?
@Programyourmindset
@Programyourmindset 2 жыл бұрын
Very useful information thank you
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍
@harmonynamai3665
@harmonynamai3665 2 жыл бұрын
Thanks a lot!! You saved my day.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad it helped you👍Do explore my channel for more stuffs✅
@gladnn
@gladnn 11 ай бұрын
Would it be possible to make a custom column header instead metadata?
@LostMellodies
@LostMellodies 2 жыл бұрын
Amazing video, very helpful.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad you liked it👍 do explore my channel for more stuffs
@mazedul1448
@mazedul1448 Жыл бұрын
Outstanding
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Thanks
@ranad2037
@ranad2037 Жыл бұрын
Thanks a lot, you're the best
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
You're welcome!
@eshaesha9100
@eshaesha9100 2 жыл бұрын
another question respected mam. How do i know which commands to use in the action Listener method. like you wrote so many command, database connectivity etc.. I mean is there any good guide for beginners?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
This question is wrt to what ? If u r asking related to jdbc then depending on buttons we hv to write code
@eshaesha9100
@eshaesha9100 2 жыл бұрын
@@CSCORNERSunitaRai yes mam, it is mainly related to jdbc
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
@@eshaesha9100 ok so when u click on add button write insert code, delete button write delete code and so on
@moalnaim
@moalnaim Жыл бұрын
Thanks you really helped me with this
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Glad I could help👍☺plz subscribe
@jesty_internm-squared4867
@jesty_internm-squared4867 2 жыл бұрын
Really Useful one....
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad it was helpful!
@ruchankayastha3273
@ruchankayastha3273 2 жыл бұрын
thanks worked like a charm
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad it worked👍
@shaikhibnasazzad
@shaikhibnasazzad 2 жыл бұрын
How to sort jtable data with the column?
@SuhanasCreations
@SuhanasCreations 2 жыл бұрын
Well explained 👍
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so much👍
@vijaykrishnagn
@vijaykrishnagn 2 жыл бұрын
Thank you for the video 😊👍
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍
@JoeCee789
@JoeCee789 2 жыл бұрын
So i'm using NetBeans and i seem to have a problem with the tblData read the comments and couldn't find a working solution how do get the tblData to work
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
What error u r getting?
@sarthakgupta096
@sarthakgupta096 Жыл бұрын
Thank you mam .
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Most welcome 😊
@S3Allinone
@S3Allinone 2 жыл бұрын
Well explained
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so much
@natarajanparameswaran6752
@natarajanparameswaran6752 2 жыл бұрын
The code doesnt work if I want to retrieve from different tables
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
It works u need just modify according to your table design
@natarajanparameswaran6752
@natarajanparameswaran6752 2 жыл бұрын
@@CSCORNERSunitaRai suppose I am having 2 tables one with 4 cols and other with 5 then for the second table the 5th col will be empty in jtable as we are reading only 4 columns
@LeticiaGAlves
@LeticiaGAlves Жыл бұрын
THANK YOU SO MUUUUUCH!!
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
You're welcome👍 please subscribe
@kartickmanna
@kartickmanna Жыл бұрын
Hello, Mam. I want to display data in a table. The data are fetched from an excel.xlsx file stored in my local drive. How to do that preferably in IntellijIdea ?
@pasha7748
@pasha7748 2 жыл бұрын
Hi, could you please tell me, where i can find the Table control name (in your case tblData)? Because when i use tblData and declare it in class, there is an error, which says: cannot invoke javax.swing.jtable.getmodel() because tblData is null... I dont know how to fix this. Could you please help me?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
It's available in toolbox where u can see available controls just drag and drop
@eshaesha9100
@eshaesha9100 2 жыл бұрын
respected mam, do we need any extension for the JFrame and the design view in Eclipse?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
If u want to use eclipse u need to add window builder
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Detailed tutorial on how to create swing in eclipse available on my channel under advanced java tutorial playlist
@eshaesha9100
@eshaesha9100 2 жыл бұрын
@@CSCORNERSunitaRai yes mam, i just watched that tutorial. You are legend mam
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
@@eshaesha9100 thank you so much dear👍please share
@francescalabonte4346
@francescalabonte4346 2 жыл бұрын
Great video
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so much👍
@amithagolla6907
@amithagolla6907 2 жыл бұрын
very useful video...
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so much
@marshyadav7885
@marshyadav7885 2 жыл бұрын
model.setColumnIdentifiers() method is not displaying names of columns, no errors. Any solution?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Did you placed ur jtable control properly? Follow the way I have shown. Delete and place again
@manohartimothy5825
@manohartimothy5825 2 жыл бұрын
Hallo Sunita , I must say that you are a very good teacher and you explained it very well....Thanking you.. I will deffinatly follow you with your more vidios....Manohar
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Thank you so for your kind words👍 Your comments motivates me for creating videos. Stay connected✅ God bless you
@Tacoburger22
@Tacoburger22 2 жыл бұрын
Thank you so much!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍
@hplat-vku
@hplat-vku 10 ай бұрын
thank u very muchhhhhh, u helped me
@endmysuffering6847
@endmysuffering6847 2 жыл бұрын
Hello, the first row ( the topmost ) is not showing up on the table how can I fix?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Ok I'll check.. When I tried it was working
@endmysuffering6847
@endmysuffering6847 2 жыл бұрын
@@CSCORNERSunitaRai I can send you my code because mine is alittle different from yours. Great vid btw!
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
@@endmysuffering6847 ok u can share on my telegram @cscorner
@endmysuffering6847
@endmysuffering6847 2 жыл бұрын
@@CSCORNERSunitaRai I was able to fix it I had to add the table to a jscrollpane. Thank you for responding still :)
@saronaraphaelv.5878
@saronaraphaelv.5878 2 жыл бұрын
Hello maam can you help me mine says no sutiable driver found
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Join my telegram and Please share screenshots of error. I will try to fix it
@samoli02
@samoli02 11 ай бұрын
How to do it with date ?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 11 ай бұрын
U want to display date datatype?
@rajapandey773
@rajapandey773 2 жыл бұрын
I am getting this issue... Unable to parse source. WindowBuilder was not able to parse source private javax.swing.JTextField textField;.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Declare this variable in class not in constructor. Only Initialization in constructor
@abusolo_3255
@abusolo_3255 2 жыл бұрын
if i want to display only 1 row, how i can do that?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You can use following method: jTable1.getModel().setValueAt(daya,row_index,col_index)
@abusolo_3255
@abusolo_3255 2 жыл бұрын
@@CSCORNERSunitaRai can you please tell me where exactly to put this line ?
@akashbro3786
@akashbro3786 8 ай бұрын
Mem addrow is not found. What i can do?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 8 ай бұрын
Hmmm, check my video again
@jobinninan4481
@jobinninan4481 Жыл бұрын
Thank you
@CSCORNERSunitaRai
@CSCORNERSunitaRai 11 ай бұрын
You're welcome👍 please subscribe
@developernilesh
@developernilesh 2 жыл бұрын
Thanks a lot, v nice👍
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Glad you liked it👍Do explore my channel for more stuff
@abunaseribrahimimani
@abunaseribrahimimani Жыл бұрын
Madam, please can I request for a demo on adding pagination on Jtable using eclips
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
I'll try
@reizsax
@reizsax 2 жыл бұрын
Please help, my ‘rs.getMetaData()’ is error. It suggests that I add cast to ‘ResultSetMetaData’ or change type of ‘rsmd’ to ‘ResultSetMetaData’. And even though I followed the suggestions, the table data still doesn’t show.
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Check your import. All jdbc related import should be from java.sql only
@abusolo_3255
@abusolo_3255 2 жыл бұрын
7:52 you said "tblData" is your table name, but isn't your table name is "student"?
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
I mean JTable control name. Thanks
@abusolo_3255
@abusolo_3255 2 жыл бұрын
@@CSCORNERSunitaRai where can i find my JTable control name?
@abusolo_3255
@abusolo_3255 2 жыл бұрын
@@CSCORNERSunitaRai it shows me error in this line (under the "tblData" exactly ) DefaultTableModel model=(DefaultTableModel) tblData.getModel();
@abusolo_3255
@abusolo_3255 2 жыл бұрын
and one of the solutions the program tell me to create local variable to "tblData"
@abusolo_3255
@abusolo_3255 2 жыл бұрын
never mind, it work fine now, thanks, i just replaced "tblData" to "table" and it worked haha
@r_nikolov1
@r_nikolov1 2 жыл бұрын
Thank you so much! =)
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍 stay connected
@jayanspaliwal5907
@jayanspaliwal5907 Жыл бұрын
Actually, I have another function in a different package that does the fetching part using a class in another package, How can I display data using that function, here are the functions: public ArrayList findAllStudent() { ArrayList al=new ArrayList(); conn=ConnectionPool.connectDB(); String query="select * from student"; try { Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(query); while(rs.next()) { StudentBean sb=new StudentBean(); sb.setEnrollmentno(rs.getString("Enrollment")); sb.setName(rs.getString("Name")); sb.setAddress(rs.getString("Address")); sb.setBranch(rs.getString("Branch")); sb.setCollege(rs.getString("College")); sb.setSemester(rs.getInt("Semester")); sb.setGender(rs.getString("Gender")); sb.setSubject1(rs.getFloat("Subject1")); sb.setSubject2(rs.getFloat("Subject2")); sb.setSubject3(rs.getFloat("Subject3")); sb.setSubject4(rs.getFloat("Subject4")); sb.setGrade(rs.getString("Grade")); al.add(sb); } conn.close(); } catch (SQLException e) { e.printStackTrace(); } return al; } The connectionpool class: public class ConnectionPool { static Connection conn; public static Connection connectDB(){ try{ // register driver Class.forName("com.mysql.cj.jdbc.Driver"); // create the connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/studentdb","root","space"); System.out.println("Database connected"); } catch (ClassNotFoundException ex){ ex.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return conn; } }
@prasannaj384
@prasannaj384 2 жыл бұрын
What is this eclipse ide version mam? Send the comment box that link
@prasannaj384
@prasannaj384 2 жыл бұрын
Because that swing set that package not available mam in my ide
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Eclipse IDE for Java Developers - 2021-06
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
If you want to get swing related stuffs you need to add WindowsBuilder. Refer this video :kzbin.info/www/bejne/opTXi2CEdryaerc
@GT-cv3xu
@GT-cv3xu Жыл бұрын
thanks♥
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
You're welcome👍
@hirunishamalka3283
@hirunishamalka3283 2 жыл бұрын
how to get data from database to JTable in selected one column
@AshishKalgutkar
@AshishKalgutkar Жыл бұрын
mam pura code dekha diya hota toh kya ho jaat ?
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Iski full video hai channel par. Chk karo
@leandrolara7450
@leandrolara7450 2 жыл бұрын
Damaste or Thanks or Graciassssssssssss : ,}
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
You're welcome👍 keep watching
@WitleRose
@WitleRose Жыл бұрын
@Eduardoo sai do fake caraio
@prernaparwani3074
@prernaparwani3074 4 ай бұрын
Java.awt . eventdispatchthread exception occurred
@babyph65
@babyph65 Жыл бұрын
getModel() is not working on me
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
Is it showing any error
@babyph65
@babyph65 Жыл бұрын
@@CSCORNERSunitaRai my compiler has some error so I re- installed it, its fine now. Thanks ♥️
@CSCORNERSunitaRai
@CSCORNERSunitaRai Жыл бұрын
@@babyph65 yes
@Nishantkumar-sr2bu
@Nishantkumar-sr2bu 2 жыл бұрын
maam i got a problem with tbldata.getModel() its showing that it can't be resolved please help
@CSCORNERSunitaRai
@CSCORNERSunitaRai 2 жыл бұрын
Declare tblData inside class. It's not able to find variable tblData
How to get data from database to JTable in java using NetBeans
12:19
Knowledge to Share
Рет қаралды 140 М.
Create User Registration Form in Java with  MySQL || Swing and JDBC
17:06
CS CORNER Sunita Rai
Рет қаралды 43 М.
Try Not To Laugh 😅 the Best of BoxtoxTv 👌
00:18
boxtoxtv
Рет қаралды 7 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 288 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 11 МЛН
JTable in JAVA Swing | ADD Data into JTable
16:25
Knowledge to Share
Рет қаралды 153 М.
Java Swing Registration Form with MySQL Database in Eclipse
18:07
Java Guides
Рет қаралды 103 М.
JAVA - How to Create a Table with JTable in Eclipse
20:55
Ganda1f
Рет қаралды 38 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 212 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 84 М.
Try Not To Laugh 😅 the Best of BoxtoxTv 👌
00:18
boxtoxtv
Рет қаралды 7 МЛН