Show Database data with a Table(Java)


  1. Open your last NetBeans project
  2. Add a Table
  3. Add a button and name it as 'show data'
  4. Right click on Libaries and add rs2xml.jar file
  5. You can download it by following link
  6. rs2xml.jar
  7. Import following librarie
  8.         import net.proteanit.sql.DbUtils;
            
  9. Double click on button and add following codes
  10.             try{
            String sql="select * from EMPDATA";
            pst=conn.prepareStatement(sql);
            rs=pst.executeQuery();
            jTable1.setModel(DbUtils.resultSetToTableModel(rs));
            }
            catch(Exception e){
            JOptionPane.showMessageDialog(null, e.getMessage());
            }
            finally{
                try{
                    rs.close();
                    pst.close();
                    
                }
                catch(Exception e){}}
            

Important

  • If you want to update your table in many time you can make a method for it. As a example if you update a data in your table you can call that method ontime.
  • If you make a method named updateTable(), you can use it as "updateTable();" anyware in your programm(only in this frame).
  • You can add this method in your main class(after initComponents();)your data will show as soon as your programm opening.

45 comments:

  1. Nice article. I would love to have the rs2xml.jar file please at hezychacha@gmail.com

    ReplyDelete
    Replies
    1. You can download it from above link. jar files can't mail.

      Delete
  2. I can't find rs2xml.jar please some one can help me to get it thank you

    ReplyDelete
  3. Thanks so very much for this quick and easy way you provided to solve table problem

    ReplyDelete
  4. Dbutil is not working on my netbean

    ReplyDelete
  5. Well done dear but where can i get the rs2xml.jar

    ReplyDelete
  6. can you give us the link where we cane download rs2xml.jar

    ReplyDelete
  7. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 
    Best Devops Training in pune
    Data science training in Bangalore

    ReplyDelete
  8. Thanks for sharing this information.My code executed in one go ,very useful for me.visiting your website is wonderful experience.

    ReplyDelete
  9. Thanks for sharing your rs2xml. jar files
    it helps me a lot for creating my thesis. Thank you so much .😊

    ReplyDelete
  10. i got two jtables on one jframe , whereby if the data is inserted on jtable1 its being reflected to jtable2,,how can i implement this on netbeans

    ReplyDelete
  11. Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in..keep sharing!!

    Android Training in Chennai

    Android Online Training in Chennai

    Android Training in Bangalore

    Android Training in Hyderabad

    Android Training in Coimbatore

    Android Training

    Android Online Training

    ReplyDelete
  12. Dbutil is not working in eclipse .. please help me

    ReplyDelete
  13. This post is so useful and informative keep updating with more information.....
    Data Science Overview
    Data Science Courses Eligibility

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. we are giving online IT and non IT courses with placement support. Get your dream job in just 3 months
    we are giving online IT and non IT courses with placement support. Get your dream job in just 3 months. Our trainners having 11 years of experience in both IT and non IT courses. we have digital marketing experts also who has above 10 years of experience in digital marketing feild.
    training and placement courses in bangalore
    Courses

    Machine Learning



    Digital Marketing



    AWS



    Python



    Data Science



    Medical Coding



    Cyber Security



    MuleSoft



    Java-Testing



    Dotnet & SQL



    Cloud computing



    Salesforce

    ReplyDelete

  16. Java, a true marvel of modern programming languages! Its versatility and robustness have enabled developers to craft remarkable applications that run seamlessly across different platforms. With its object-oriented nature and extensive libraries, Java empowers developers to create elegant and efficient code. Whether it's building complex enterprise systems or sleek mobile applications, Java's reliability shines through, making it a top choice for many developers worldwide. Its constant evolution and community support ensure that Java remains at the forefront of technology, paving the way for innovation and groundbreaking solutions. Hats off to Java for being a driving force behind countless technological advancements besides this if you want to know more info so you can click here and visithttps://theamberpost.com/post/gain-a-deeper-understanding-of-your-customers-through-data-analytics

    ReplyDelete
  17. Great article !!!. The method you've shared regarding this technology helped me move to the next stage and contained a plenty of information. java classes in pune

    ReplyDelete

  18. Informative post. Thank you sharing. Please visit our website to learn new courses.

    ReplyDelete
  19. AF6CA
    ----
    ----
    ----
    matadorbet
    ----
    ----
    ----
    ----
    ----

    ReplyDelete
  20. CB8DB
    ----
    ----
    ----
    matadorbet
    ----
    ----
    ----
    ----
    ----

    ReplyDelete