Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003

    Unanswered: db2 getGeneratedKeys()


    Im using a db2 v8.1 enterprise edition and the jdbc driver that comes with the db2 v8.1 (

    Now Im trying to use the getGeneratedKeys() and I get the following error:
    java.lang.AbstractMethodError: ()Ljava/sql/ResultSet;

    The code looks like:

    public ResultSet executeUpdate(String SQL){

    try {

    stmt = con.createStatement();
    rs = stmt.getGeneratedKeys();

    } catch(Exception e){
    WriteAppend writeappend = new WriteAppend();
    writeappend.writeErrorLogg(e.toString(), "DBConnect.executeUpdate", SQL);
    return rs;

    The sql string that I send to the executeUpdate is:
    INSERT INTO user (name) VALUES ('john')

    How can I get the getGeneratedKeys to work? Do I have to do something with the column that contains the generated key?

    or does anybody know a function in db2 that ret revise the columns that the database generates?

    Anders Sandholm
    Last edited by sandholm; 03-17-03 at 10:22.

  2. #2
    Join Date
    Nov 2003

    Re: db2 getGeneratedKeys()

    Originally posted by sandholm
    stmt = con.createStatement();
    rs = stmt.getGeneratedKeys();
    i think you have to do the following:

    stmt.executeUpdate(SQL,Statement.RETURN_GENERATED_ KEYS);

    but you might have allready solved it :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts