I'm writing simple Java code and I have to execute an SQL query on my Postgresql database. The result of this database (I've checked manually) is a simple table made by one column and two integer numbers, like this:
My problem is that I cannot find any way to read these two rows. My reading code is:
List< Short > lista = new List< Short >();
_rs = _stmt.executeQuery(query);
while (_rs.next()) {
lista.add((short)_rs.getInt(1));
}
This code only reads the 1st row, but there's no way to make it read the 2nd row. The Short list "lista" contains always 1 element. It's like if the ResultSet does not proceed in reading the second row...
How to read both the rows?
query
look like? – MadProgrammer 1 hour ago