I created a *JTable* in Java Swing.

How do I update it so that it displays all the values stored in my MySQL database?

I tried searching on the web, but still no luck.

This is my code...

```
    try{
        PreparedStatement ps = con.prepareStatement("SELECT * FROM Users ");
        ResultSet result = ps.executeQuery();
        while(result.next()){
            salesTable.setValueAt(result.getString("users"), 1, 1);
        }
    }
    catch(SQLException sqle){
        sqle.printStackTrace();
    }

```

I keep getting the `java.lang.ArrayIndexOutOfBoundsException: 1 >= 0` error.

I would greatly appreciate it if someone could tell me where I am going wrong and a possible fix for this bug.