If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Java SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-17-03, 03:37
cesar cesar is offline
Registered User
 
Join Date: Feb 2003
Posts: 13
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
Reply With Quote
  #2 (permalink)  
Old 07-17-03, 11:32
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: Java SQL

Quote:
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(...);
Reply With Quote
  #3 (permalink)  
Old 07-18-03, 04:45
cesar cesar is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 07-18-03, 09:36
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
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
Reply With Quote
  #5 (permalink)  
Old 07-21-03, 04:00
cesar cesar is offline
Registered User
 
Join Date: Feb 2003
Posts: 13
Quote:
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
Reply With Quote
  #6 (permalink)  
Old 08-05-03, 14:15
maabed maabed is offline
Registered User
 
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,

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

Thanks,

Cesar
Reply With Quote
  #7 (permalink)  
Old 08-11-03, 04:30
cesar cesar is offline
Registered User
 
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
--------------------------------------------------------------------------------
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On