wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to fix this error exception error ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to fix this error exception error ? " Watch "How to fix this error exception error ? " New topic
Author

How to fix this error exception error ?

Jahar Heard
Greenhorn

Joined: Jan 09, 2010
Posts: 20
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

Joined: Sep 08, 2007
Posts: 3064
    
  33

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:


Mohamed Sanaulla | My Blog
Jahar Heard
Greenhorn

Joined: Jan 09, 2010
Posts: 20
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

Joined: Oct 12, 2001
Posts: 1179

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.


Regards, Rene Larsen
Dropbox Invite
Jahar Heard
Greenhorn

Joined: Jan 09, 2010
Posts: 20
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 .
 
 
subject: How to fix this error exception error ?
 
Similar Threads
Using sessions for authentication
Else loop not working
servlet not displaying is downloading
ResultSet can not print the first row
cannot find symbol