• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to fix this error exception error ?

 
Jahar Heard
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.servlet.ServletException: java.sql.SQLException: Before start of result set




this is the code from where it comes . Any ideas ?
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vladislav Rashkov wrote:


The ResultSet obtained in the above lines of code would not be pointing to the results obtained from the query. So in order to make it point to the first set of results, you would have to call rs.next()


Alternatively, you can alter the query/code as follow:
 
Jahar Heard
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I found my mistake . I was trying with the wile loop, but seams to be the if operator the right answer. Thanks
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vladislav Rashkov wrote:Thanks!
I found my mistake . I was trying with the wile loop, but seams to be the if operator the right answer. Thanks

It depends on the number of rows returned - if you use IF then you'll only get the first row, and with WHILE you'll get all rows.
 
Jahar Heard
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But with if it works, like I have that two String the name and the password, and when I input them, they are right, no problems, the connection is OK .
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic