Adnan
Adnan

Reputation: 4607

Check for unique row existence via jdbc

I'm using resultSet.next() to check whether a unique row exist in the database or not. But it is returning false even when the row exists in the database.

Can anyone explain the first comment of the first answer of this page?.

Upvotes: 1

Views: 829

Answers (1)

sudmong
sudmong

Reputation: 2036

If there is any row in the database which you are expecting, then first call to resultSet.next() should return true.

Answer on this page. If you are expecting only one row to be returned from database then first call to resultSet.next() will return true and any furter call will return false. First next() call on resultSet takes cursor to the first row.

Upvotes: 2

Related Questions