A resultset doesn't have a size until you have asked it to read all the rows from the database. Since you want to get all the rows anyway, the easiest approach is to read them into a List and then convert that to an array:List rowList = new ArrayList();
while (rs.next()) {
rowList.add(rs.getString(1));
}
String[] rowArray = new String[rowList.size()];
rowArray = (String[]) rowList.toArray(rowArray);