Results 1 to 7 of 7

Thread: Java SQL

  1. #1
    Join Date
    Feb 2003
    Posts
    13

    Unanswered: Java SQL

    Hello,

    I'm trying to use the SQL java classes to access a DB2 database.
    Specifically, I'm using a ResultSet object to manage the results of a query.
    However some of the methods for scrolling work well, like ResultSet.next(), but for plenty of them, like ResultSet.absolute(int) I get this kind of error message:

    java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2ResultSet.absolute

    Why do some methods work and other do not?

    Thanks for your help !

    Cesar

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: Java SQL

    Originally posted by cesar
    However some of the methods for scrolling work well, like ResultSet.next(), but for plenty of them, like ResultSet.absolute(int) I get this kind of error message:

    java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2ResultSet.absolute

    Why do some methods work and other do not?

    I think this may happen because your result set is not scrollable (this is the default behaviour). In that case you can only step through it in one direction using next().

    To create a scrollable result set you should do this:
    Code:
     Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = stmt.executeQuery(...);

  3. #3
    Join Date
    Feb 2003
    Posts
    13
    I tried to create the Statement object as you said but then I got the message error for that method:

    java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2Connection.createStatement

    which is bizarre since createStatement works well without parameters.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Originally posted by cesar
    I tried to create the Statement object as you said but then I got the message error for that method:

    java.lang.AbstractMethodError: COM/ibm/db2/jdbc/app/DB2Connection.createStatement

    which is bizarre since createStatement works well without parameters.
    What version of the JDBC driver do you use? I belive limited support for scrollable resultsets is only implemented since JDBC 2.0

  5. #5
    Join Date
    Feb 2003
    Posts
    13
    Originally posted by n_i
    What version of the JDBC driver do you use? I belive limited support for scrollable resultsets is only implemented since JDBC 2.0

    Right ! I had not set the JDBC 2.0.
    Now I can use the scrollable methods without problems.

    Thanks,

    Cesar

  6. #6
    Join Date
    Nov 2002
    Posts
    3

    Scrollable result set

    Will you please share with us more details on your resolution. We are encountering the same issue.
    Thanks,

    Originally posted by cesar
    Right ! I had not set the JDBC 2.0.
    Now I can use the scrollable methods without problems.

    Thanks,

    Cesar

  7. #7
    Join Date
    Feb 2003
    Posts
    13
    Hi Maabed,

    Here there is a summary of what I did to make it work:

    * To enable jdbc 2.0 in Windows, go to your DB2 folder and run the application usejdbc2.bat (in my case, C:\SQLLIB\java12\usejdbc2.bat).
    I suggest you to run it from a CMD window to see the details.
    Be sure all db2 applications are closed and services stopped.
    * In your program, create your Statement object as it follows:

    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSIT IVE, ResultSet.CONCUR_READ_ONLY);

    And execute the query:

    ResultSet rs = stmt.executeQuery(...);

    Then you can use all the scrollable methods of the class ResultSet.

    I hope it works for you as well.

    Regards,

    Cesar
    --------------------------------------------------------------------------------

Posting Permissions

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