File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes ResultSet.next() returning false; should return true Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet.next() returning false; should return true" Watch "ResultSet.next() returning false; should return true" New topic
Author

ResultSet.next() returning false; should return true

Cilla Pestoff
Greenhorn

Joined: Mar 15, 2004
Posts: 6
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

Joined: Jan 10, 2002
Posts: 61774
    
  67

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet.next() returning false; should return true