Samuel Johnson

Greenhorn
+ Follow
since Apr 20, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Samuel Johnson

Sorry. url should be:


[edited to disable smilies]
[ July 07, 2004: Message edited by: Jeanne Boyarsky ]
JDBC Driver are not Application "server" specific. It is, however, database server specific. Click here and get yourself an Oracle JDBC Driver (classes12.jar).

Add classes12.jar into your CLASSPATH and try the following code where xxx.xxx.xxx.xxx is the IP of your Oracle Server

String url = "jdbc racle:thin:@xxx.xxx.xxx.xxx:1521 racleSID";
String userId = "";
String password = "";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(url, userId, password);
Statement stmt = con.createStatement();
//==================
} catch (Exception e) {

}
Thank you for your replay. Yes, like you said, "Database neutrality". I have tried the Oracle's own implementation. It works fine except that "CachedRowSet rowset = new OracleCachedRowSet()" cause a compilation error which breaks the whole idea of using JDBC.

The closest thing I can do is using "RowSet rowset = new OracleCachedRowSet()". Please let me know if you found anything about using CachedRowSet. Thank you.
Have anyone tried the Sun's new(well, maybe not that new) CachedRowSet RI with Oracle type4 driver (thin driver)? I can't get com.sun.rowset.CachedRowSetImpl to work with the Oracle9i. My code works fine with the MySQL4.0+ type 4 driver and Oracle9i+ Jdbc-Odbc bridge. It always throws the following exception at "rowset.execute()"

java.sql.SQLException: Invalid scale size. Cannot be less than zero
at javax.sql.rowset.RowSetMetaDataImpl.setScale(Unknown Source)
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 com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
at RowSetTest1.main(RowSetTest1.java:60)

My code looks like this

Class.forName(driverName);
CachedRowSet rowset = new CachedRowSetImpl();
rowset.setReadOnly(false);
rowset.setUrl(url);
rowset.setUsername(userId);
rowset.setPassword(password);
rowset.setCommand(sql);
rowset.setTableName("emp");
rowset.execute();

Thanks
Suppost I have the following code and MyClass is in the classpath
Could anyone please tell me
1. MyClass loaded
2. Memory allocated for MyClass
3. Object c1 created
When these 3 step happend? (1 and 2 together or 2 and 3 together or they all separted)
Thanks a lot
public class Test {
public static void main(String[] args) {
MyClass c1 = null;
MyClass c2 = null;
//other stuff

c1 = new MyClass();
c2 = new MyClass();
}
}
18 years ago