title: Adding row to DefaultTableModel
body: <p><a href="http://codepaste.net/ujhdq2" rel="nofollow">http://codepaste.net/ujhdq2</a> </p>
  
  <pre><code>    private Connection Econn;
      private DefaultTableModel examTable = new DefaultTableModel();
      public StudentInfoFrame(int eid) {
          initComponents();
          this.e_id = eid;
          try
          {
              jTable2.getParent().setBackground(Color.black);
              SimpleDataSource.init();
              Econn = SimpleDataSource.getConnection();
              jTable2.setModel(examTable);
              retrieveExams();
          }
          catch(SQLException | ClassNotFoundException e)
          {
              System.out.println(e);
          }
      }   
  
  private void retrieveExams()
      {
          try
          {
              Statement stat = Econn.createStatement();
              String query = "SELECT date, name,forename,surname,status,Exam "+
              "FROM studentexam sx INNER JOIN Exam e ON sx.ex_id = e.ex_id " +
              "INNER JOIN employee em ON e.head = em.e_id WHERE st_id = "+this.e_id;
              ResultSet result = stat.executeQuery(query);
              if(result.first())
              {
              while(result.next())
              {
                  String headname = result.getString("forename")+" "+result.getString("surname");
                  String name = result.getString("name");
                  int status = result.getInt("status");
                  String pres;
                  if(status == 1)
                  {
                      pres = "Yes";
                  }
                  else
                  {
                      pres = "No"; 
                  }
                  String exam;
                  if(result.getInt("Exam") == 1)
                  {
                      exam = "Yes";
                  }
                  else
                  {
                      exam = "No";
                  }
                  Date date = result.getDate("date");
                  int day = date.getDay();
                  int year = date.getYear()+1900;
                  int month = date.getMonth()+1;
                  String datum = year+"-"+month+"-"+day; 
                  int row = examTable.getRowCount()+1;
                  examTable.insertRow(row, new Object[] { name,headname,datum, exam,pres });
              }
              }
  
          }
  </code></pre>
  
  <p>This gives me this error:</p>
  
  <p>Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1 > 0.</p>
  
  <p>Any idea?</p>