Results 1 to 6 of 6

Thread: rowset.jar

  1. #1

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    rowset.jar

    Hi,

    This is in relation to my post crimson.jar. The problem is I have downloaded the rowset.jar and placed it in my folder c:\java\lib.This folder contains the other .jar files too.I have set the classpath to point to c:\java\lib in the environment variables....When I tried running the code an error appears:

    package sun.jdbc.rowset does not exist
    What are the correct steps in order for the rowset.jar to work correctly?

    Hope for any advice on this....


    By the way, I'm using JDK1.5 as my compiler, cloudscape as my dbms...

    Here's the error generated from the code:

    C:\BegJavaDB\Ch11>javac -cp . rowset/CachedRowSetExample.java
    rowset/CachedRowSetExample.java:7: package sun.jdbc.rowset does not exist
    import sun.jdbc.rowset.*;
    ^
    rowset/CachedRowSetExample.java:11: cannot find symbol
    symbol : class CachedRowSet
    location: class rowset.CachedRowSetExample
    CachedRowSet cachedRs;
    ^
    rowset/CachedRowSetExample.java:43: cannot find symbol
    symbol : class CachedRowSet
    location: class rowset.CachedRowSetExample
    cachedRs = new CachedRowSet();
    ^
    3 errors
    Thanks...
    Last edited by KGComputers; Jun 29th, 2006 at 07:59 PM.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  2. #2

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: rowset.jar

    Hi

    Does anyone have rowset.jar that functions correctly? Where do I put the jar files in my path? c:\jdk1.5\lib or jre\lib? I'm not using any web server for my codes..Just plain jdbc programming using cloudscape...


    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: rowset.jar

    I guess I've been using IDEs long enough that I forgot about that
    But after doing some research I found out that you can put the file anywhere and add a reference to it in your classpath from computer settings. because a .jar file is dealed with as a folder apparently
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: rowset.jar

    Hi,

    Thanks for the tip...Do you happen to have a good rowset.jar? Ive been downloading series of rowset.jar from Sun's early access....Nothing of them seems to work fine..If you can send one(good rowset.jar), that would be a great help to some of us working with java...


    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: rowset.jar

    why don't you use "javax.sql.RowSet"?
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  6. #6

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: rowset.jar

    Hi,

    Ive tested javax.sql.rowset..The Compile does not generate errors..But in java command it gives me these specific errors:

    Exception in thread "main" java.lang.AbstractMethodError: c8e.cs.g.locatorsUpdat
    eCopy()Z
    at com.sun.rowset.CachedRowSetImpl.initMetaData(Unknown Source)
    at com.sun.rowset.CachedRowSetImpl.populate(Unknown Source)
    at com.sun.rowset.internal.CachedRowSetReader.readData(Unknown Source)
    at com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
    at rowset.CachedRowSetExample1.populateRowSet(CachedRowSetExample1.java:
    48)
    at rowset.CachedRowSetExample1.main(CachedRowSetExample1.java:19)
    Here's the code:

    Code:
    package rowset;
    
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.sql.rowset.*;
    import com.sun.rowset.*;
    import com.sun.rowset.CachedRowSetImpl;
    
    public class CachedRowSetExample1 {
      CachedRowSetImpl cachedRs;
    
      public static void main(String[] args) throws Exception{
    
        CachedRowSetExample1 crse = new CachedRowSetExample1();
    
        try {
          crse.populateRowSet();
          boolean done = false;
          BufferedReader in =
    	new BufferedReader(new InputStreamReader(System.in));
          while (!done) {
    	System.out.print("Enter a row number (0 to exit) : ");
    	String s = in.readLine();
    	int result = new Integer(s).intValue();
    	if (result == 0) {
    	  done = true;
    	} else {
    	  crse.showRow(result);
    	}
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    
      void populateRowSet() throws ClassNotFoundException, SQLException {
    	cachedRs = new CachedRowSetImpl();
    	Class.forName("COM.cloudscape.core.JDBCDriver");
        String url = "jdbc:cloudscape:c:/wrox/database/Wrox4370.db";
        String username = "APP";
        String password = "";
        Connection connection = DriverManager.getConnection(url);
    
        String sql = "select * from Stores";
        cachedRs.setCommand(sql);
        cachedRs.execute(connection);
        connection.close();
      }
    
      void showRow(int row) throws SQLException {
        try {
    		cachedRs = new CachedRowSetImpl();
          cachedRs.absolute(row);
        } catch (SQLException e) {
          System.out.println("Caught exception. row=[" + row +
    			 "] message=[" + e.getMessage() + "]");
          String message = e.getMessage().toLowerCase();
          if (message.indexOf("invalid cursor position") == -1) {
    	//if it's not an invalid position, rethrow the exception
    	throw e;
          }
        }
    
        if (cachedRs.isBeforeFirst()) {
          System.out.println("Index " + row + " is before first row");
        } else if (cachedRs.isAfterLast()) {
          System.out.println("Index " + row + " is after last row");
        } else {
          System.out.println("StoreId : " + cachedRs.getInt("StoreID") +
    			 " :: StoreDescription : " +
    			 cachedRs.getString("StoreDescription"));
        }
      }
    }
    I have read several tutorials on CachedRowSet...Have I missed something? Are my commands correct? Instantiation of CachedRowSet objects? Package accessing?

    Greg
    Last edited by KGComputers; Jul 9th, 2006 at 09:51 PM.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Posting Permissions

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



Click Here to Expand Forum to Full Width