Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jtable how to use rs2xml

Tags:

java

swing

jtable

I'am currently newbie at java, and I've been searching for a effective way to put database informations to jtable and I heard about rs2xml. I really want to learn this because other methods makes me confuse and gives me headache.

Does anyone know how to use it effectively ? And if you don't mind can you explain with a simple code.

Thanks in advance.

like image 764
Vivian Maya Avatar asked Dec 28 '14 19:12

Vivian Maya


People also ask

What is the use of rs2xml jar?

The rs2xml jar is used to display the data in a table format. So, once you create a project in Eclipse IDE, you have to import the rs2xml jar and JDBC connector JAR into the project.

What is rs2xml file?

rs2xml is a jar library that can be used to make the result set of a query an input for the table model is pretty useful @camickr. – Mohammed Housseyn Taleb.


1 Answers

    import net.proteanit.sql.DbUtils;


  try {
    st = conn.createStatement();
    st.executeQuery(q);
    ResultSet rs = st.executeQuery(q);
    jTable1.setModel(DbUtils.resultSetToTableModel(rs));
       }
  catch (SQLException ex) {
  JOptionPane.showMessageDialog(null, ex);
   } finally {
     try {
    rs.close();
  } catch (SQLException e) { /* ignore */
  }

  try {
    st.close();
  } catch (SQLException e) { /* ignore */
 }
  }

that a sample of use video tutorial

like image 172
Mohammed Housseyn Taleb Avatar answered Sep 22 '22 11:09

Mohammed Housseyn Taleb