This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rs.first() error

 
ed copony
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey peter.. oops i didnt notice it .. thanx for correcting my reply..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic