• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CachedRowSet is abstract; cannot be instantiated?

 
Jason Kwok
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, I've just started using Java so I'm still learning in every which way. I'm using JDK 5.0 and tomcat, and I'm trying to put my ResultSet results into a CachedRowSet.

Just using the same code from the rowset tutorial from Sun, it won't allow me to initialize the rowset as they have done. What can I do about this?

This is the error:
javax.sql.rowset.CachedRowSet is abstract; cannot be instantiated
CachedRowSet crs = new CachedRowSet();
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use CachedRowSetImpl instead ! import com.sun.rowset.CachedRowSetImpl

CachedRowSetImpl is implementing CachedRowSet. Visit this link for more info.

Shailesh
 
Jason Kwok
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really want to start using the cachedrowset, is there anyone who knows how I can fix this? Any help would be appreciated.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you follow the link i posted ?

CachedRowSet is an interface and you can not get instance of it.
however CachedRowSet was class when it was released first
[ April 01, 2005: Message edited by: Shailesh Chandra ]
 
Jason Kwok
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did trying importing that library and using the code you had suggested but I received an error about the package not being found. Do I have to download a jar for this to work?

On a second thought, because CachedRowSet is an interface now, does this mean I can never use it now? Or has can it be used?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
since you are using jdk1.5 hence you need not to import any jar file. This class file is placed in rt.jar

CachedRowSet is an interface so it contains only method declaration



and CachedRowSetImpl is class implementing same signatuture of class is



Thanks
Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic