title: JDBC database java using vector of vectors
body: <p>Does someone can help my by creating an database query with vectors?</p>
  
  <p>I want to query the <code>Lieferranten</code> Table of the <code>nordwind</code> database and showing it on a <code>JTable</code>.</p>
  
  <p>My problem is how to show data sets in the <code>jTable1</code>?</p>
  
  <p><strong>This is my previous code:</strong></p>
  
  <pre><code> import java.awt.*;
   import java.awt.event.*;
   import javax.swing.*;
   import javax.swing.event.*;
   import javax.swing.table.*;
   import java.sql.*;
   import java.util.*;
  
  
  
    public class Anzeige extends JFrame {
  
  
  
  
    private JTable jTable1 = new JTable(5, 5);
    private DefaultTableModel jTable1Model = (DefaultTableModel) jTable1.getModel();
    private JScrollPane jTable1ScrollPane = new JScrollPane(jTable1);
  
  
  
   public Anzeige (String title) {
    super (title);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    int frameWidth = 676; 
    int frameHeight = 467;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2;
    setLocation(x, y);
    Container cp = getContentPane();
    cp.setLayout(null);
  
  
    // Anfang Komponenten
    jTable1ScrollPane.setBounds(72, 56, 521, 289);
    jTable1.getColumnModel().getColumn(0).setHeaderValue("Title 1");
    jTable1.getColumnModel().getColumn(1).setHeaderValue("Title 2");
    jTable1.getColumnModel().getColumn(2).setHeaderValue("Title 3");
    jTable1.getColumnModel().getColumn(3).setHeaderValue("Title 4");
    jTable1.getColumnModel().getColumn(4).setHeaderValue("Title 5");
    cp.add(jTable1ScrollPane);
    // Ende Komponenten
    setResizable(false);
    setVisible(true);
  
  
  
   }
  
  
  
  public static void main(String[] args) {
  new Anzeige("Anzeige");
  
  
  
     try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
  
      Connection dbConn =    DriverManager.getConnection("jdbc:mysql://localhost:3306/nordwind", "root", "");
  
    Statement statement = dbConn.createStatement();
  
    ResultSet results = statement.executeQuery("SELECT * FROM Lieferranten");
  
    Vector vector = new Vector();
  
  
  
    while (results.next()) {
      String s1 = results.getString(2);
      String s2 = results.getString(5);
      System.out.println(s1 + "\n" + s2);
      System.out.println(results.getString(2) + " " + results.getString(5));
  
      Vector data = new Vector();
      data.add(results.getString(1));
      data.add(results.getString(2));
      vector.add(data);
  
  
    }
    //results.close();
    statement.close();
    dbConn.close();
  
  
  }
  catch (InstantiationException e) {
    System.err.println("Error in Instantiation!");
  }
  
  catch (ClassNotFoundException e) {
    System.err.println("Class not found!");
  }
  
  catch (IllegalAccessException e) {
    System.err.println("Access denied!");
  }
  
  
  catch (SQLException e) {
    System.err.println("SQL Error!");
  }
  
  
  }
  
  }
  </code></pre>