12

I'm using CachedRowSet to hold the ResultSet form DB. According some demo code: I write below code:

CachedRowSetImpl crs = new CachedRowSetImpl();

But eclipse prompt me that CachedRowSetImpl cannot be resolved to a type. So I know I need to import some package. But I don't know which one to import? Anyone knows?

Kai
  • 38,985
  • 14
  • 88
  • 103
roast_soul
  • 3,554
  • 7
  • 36
  • 73
  • Eclipse shows this error - Access restriction: The type CachedRowSetImpl is not accessible due to restriction on required library C:\xyz\lib\rt.jar Even when rt.jar is always there in every java project created in eclipse – david blaine May 28 '13 at 07:35
  • More importantly, is this CachedRowSetImpl actively supported ? – david blaine May 28 '13 at 07:58
  • here is a related post for eclipse users who use this class - http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar – david blaine May 28 '13 at 07:58

4 Answers4

12

CachedRowSetImpl class is packaged in rt.jar. So you don't need to add any jar for this class. Can you try to remove JRE currently added to eclipse buildpath and again re-add it.

Yogesh Ralebhat
  • 1,376
  • 1
  • 13
  • 29
9

Use this code:

import javax.sql.rowset.CachedRowSet;
import com.sun.rowset.CachedRowSetImpl

...

CachedRowSet rowSet = new CachedRowSetImpl();
S.Yavari
  • 876
  • 8
  • 25
1

If your eclipse classpath is properly set, I mean the jar that includes is in eclipse classpath, then use ctrl+shift+o. This will organize the imports. Adding the missing import and removing the unnecessory.

Jaydeep Patel
  • 2,394
  • 1
  • 21
  • 27
  • yes, I know what you mean.The eclipse will import the package automaticlly. But in my eclipse, there is no 'import' option.Maybe I need add some jar? – roast_soul Feb 05 '13 at 02:31
0

You should import com.sun.rowset.jar into your project:

  1. Download the library from here.
  2. Right click on Project > Properties > Java build Path > Select "Libraries" > Add External JARs...
  3. Then Browse... to where you've saved com.sun.rowset.jar and select it.
  4. Click OK.
Shiva127
  • 2,413
  • 1
  • 23
  • 27
JViM
  • 1
  • 3