wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes rs.first() 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 » Java » Beginning Java
Bookmark "rs.first() error" Watch "rs.first() error" New topic
Author

rs.first() error

ed copony
Greenhorn

Joined: Nov 29, 2001
Posts: 10
hi. i am getting the following error when compiling:
cannot find method "first()"
-------
the code is this:
...
ResultSet rs = stmt.executeQuery("valid sql statement here");
if (rs.first()) {
...
and at the top of the file i have imported the java.sql package like so:
import java.sql.*;
------
so how come i can't call first() when it found the class ResultSet? and is there a better way to determine if anything was returned by the query?
thanks!
ed
ed copony
Greenhorn

Joined: Nov 29, 2001
Posts: 10
after more digging i see that my driver does not support the first() method -- i guess that explains it.
(i'll just be in here talking to myself if anyone needs me.)
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
hey ED
while creating the statement object do the following

and then execute the query
it will work
------------------
IBM Certified WebSphere Application Server V3.5 Specialist


regards,<br />Dharmesh Chheda
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Won't work - he got a compile-time error, not a run-time error. Willing to bet that it's a JDBC 1 driver.
- Peter
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
hey peter.. oops i didnt notice it .. thanx for correcting my reply..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rs.first() error
 
Similar Threads
first()' method of ResultSetMetaData clas
insert statement is not working
ResultSet Fnction
Field not found - need help on code
Insert and MoveFirst