• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet.next() returning false; should return true

 
Cilla Pestoff
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am very new to database programming.
Here is my problem code:
this.myDBManager.setEditQuery("select ACS_DATE, ERAT, ERCC, ERCA, ER06, ER07, ER09 from PGOODWYNE.ACS_FORM where ACS_ID = ?");
this.myQueryStatement = this.myDBManager.getPreparedEditQuery();
this.myQueryStatement.setInt(1, acsNum);
ResultSet rs = this.myQueryStatement.executeQuery();
java.sql.Date[] mydates = new java.sql.Date[7];
rs.next();
for(int i = 0; i < mydates.length; i++){
java.sql.Date d = rs.getDate(i + 1);
if(rs.wasNull())
mydates[i] = null;
else
mydates[i] = d;
}
Here's the thing:
rs.next() is returning false.
I have executed this SQL statement in my Database Pilot. I always get one row returned with data. I have checked the metadata for the resultset. It returns 7 columns, the first one being labeled ACS_DATE, as it should.
So, I don't know why when I test the SQL statement I get one valid row returned, but here rs.next() returns false. Oh, and I am executing this on a new database connection, this is the first prepared statement on it.
I am at a loss, any comments/suggestions/help is greatly appreciated.
--Priscilla G.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65126
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Priscilla G.",
We're pleased to have you here with us in the JDBC forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Also, please use the UBB code tags when posting code examples -- that way, you code formatting will be preserved.
Thanks!
bear
Forum Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic