Advertisement
Rize13

Untitled

Nov 18th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public void populateTable (){
  2. try{
  3. Class.forName("com.mysql.jdbc.Driver").newInstance();
  4. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Proiect", "root" , "5416dif!!");
  5. PreparedStatement pst= con.prepareStatement("select codd, nume, artist, categorie, data_lansare, pret from discuri;");
  6. ResultSet rs=pst.executeQuery();
  7. this.jTable1.setModel(DbUtils.resultSetToTableModel(rs));
  8. }
  9.  
  10. catch(Exception exc){
  11. exc.printStackTrace();};
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement