 <p>You are supposed to initialize the array to a non null value in order do use it :</p> <pre><code>String systems[][] = new String[n][5]; </code></pre> <p>where <code>n</code> is the max capacity of the array.</p> <p>If you don't know in advance how many rows your array should contain, you can use an <code>ArrayList&lt;String[]&gt;</code> instead, since the capacity of an <code>ArrayList</code> can grow.</p> <p>For example:</p> <pre><code> Statement st = con.createStatement(); List&lt;String[]&gt; systems = new ArrayList&lt;String[]&gt;(); String item = "SELECT ram, cpu, mainboard, cases, gfx FROM computer_system"; ResultSet rs = st.executeQuery(item); while (rs.next()){ String[] row = new String[5]; row[0] = rs.getString("ram"); row[1] = rs.getString("cpu"); row[2] = rs.getString("mainboard"); row[3] = rs.getString("cases"); row[4] = rs.getString("gfx"); systems.add(row); } </code></pre>