• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help whit ResultSet

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need help for the next methods (first(),last(),absolute())because dont work and send me this error in
import java.sql.*;
public class Query {
public static void main(String[] args) {
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch (Exception e) {
System.err.println("Driver Error...");
e.printStackTrace();
}
try {
String cadCon="jdbc:mysql://127.0.0.1/xxx";
Connection conexion = DriverManager.getConnection(cadCon,"xx ","xx");
Statement sentencia = conexion.createStatement();
String consulta="SELECT * FROM bajas";
ResultSet srs = sentencia.executeQuery(consulta);
srs.absolute(4); //here send me Error
int rowNum = srs.getRow(); // rowNum should be 4
srs.relative(-3);
int rowNum2 = srs.getRow(); // rowNum should be 1
srs.relative(2);
int rowNum3 = srs.getRow(); // rowNum should be 3
System.out.println("one "+rowNum+"two"+rowNum2+"three"+rowNum3);
and then i got the error
java.lang.AbstractMethodError
at Consulta.main(Consulta.java:26)
Exception in thread "main"
the method srs.next() work it, so I dont know what I have to do? thank for your help.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The MySQL's ResultSet class do not has implemented the first(), last() & absolute() methods.
Every database vendor implements its own class from the ResultSet interface, so sometimes you dont have all the methods available.
Take a look at the documentation included with the database you chose.
HTH
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check you are using the most recent version of the mm.MySQL drivers. I was pretty sure those methods had been implemented
 
Hugo de la Mora
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I downloaded the new driver and then work it, I really apreciate it, thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic