db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hiles <markahi...@fastmail.fm>
Subject Re: Re-using an existing db and archiving data
Date Tue, 18 Mar 2008 23:03:40 GMT
Ok, need a little guidance again..

I perform a query which returns some results that I'd like to store in a
2-dimensional array. But when I try running a loop to go through the results, I
get a null pointer exception happening. I know that the query is returning 2
rows of results, so why can't I go through them?

Here's an example of the kind of thing I'm trying to do...

rs = stmt.executeQuery("...");
rs.last();
arr = new String[rs.getRow()][2];
rs.first();
int i;
for(i = 0; rs.next(); ++i) {            // null pointer exception
    arr[i][0] = rs.getString("...");
    arr[i][1] = rs.getInt("...");
}



Mime
View raw message