From the database you need to get and save the values in a two-dimensional array Object[][] data . It should have (as in the table in the database) 4 columns.
I did this:
try { con = DriverManager.getConnection(url, user, password); stmt = con.createStatement(); rs = stmt.executeQuery(query); count = 0; while(rs.next()) { count++; } Object[][] data = new Object[count][4]; count = 0; while(rs.next()) { data[count][0] = rs.getString(1); data[count][1] = rs.getString(2); data[count][2] = rs.getString(3); data[count][3] = rs.getString(4); count++; } } catch (SQLException e1) { e1.printStackTrace(); } finally { try { con.close(); } catch(SQLException se) {} try { stmt.close(); } catch(SQLException se) {} try { rs.close(); } catch (SQLException se) {} } But JAVA gives NullPointerExeption ! My checks revealed that the values in the array are all NULL .