aspose file tools
The moose likes JDBC and the fly likes How to fix this error exception error ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply 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
Bartender

Joined: Sep 08, 2007
Posts: 2925
    
  15

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 .
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to fix this error exception error ?
 
Similar Threads
Else loop not working
Using sessions for authentication
servlet not displaying is downloading
cannot find symbol
ResultSet can not print the first row