Click to See Complete Forum and Search --> : rowset.jar
KGComputers
Jun 29th, 2006, 12:26 PM
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... :) :) :)
KGComputers
Jul 6th, 2006, 06:50 PM
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
ComputerJy
Jul 7th, 2006, 05:20 AM
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
KGComputers
Jul 8th, 2006, 09:57 AM
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 :)
ComputerJy
Jul 8th, 2006, 10:17 AM
why don't you use "javax.sql.RowSet"?
KGComputers
Jul 9th, 2006, 09:45 PM
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:
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 :) :) :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.