Posted By:
Ling_Wang
Posted On:
Tuesday, May 21, 2002 08:59 AM
Hi there, I am using Sun's CachedRowSet on Weblogic Appserver 6.1/Oracle8i. CachedRowSet works fine with using straight JDBC Class.forName+CachedRowSet.setUrl and is fast. But I would like to use connection pool maintained by Weblogic Appserver. I know the way to go is through CachedRowSet.setDataSourceName. The problem I have is Sun's implementation uses a different JNDI class factory than Weblogic. I can't just get the InitialContext by doing the following: CachedRowSet crs=new CachedRowSet(); InitialContext ic = new InitialContext(); crs.setDataSourceName("mydatasource"); crs.execute("select * from mytable"); Because Weblogic will complain (the above c
More>>
Hi there,
I am using Sun's CachedRowSet on Weblogic Appserver 6.1/Oracle8i. CachedRowSet works fine with using straight JDBC Class.forName+CachedRowSet.setUrl and is fast. But I would like to use connection pool maintained by Weblogic Appserver. I know the way to go is through CachedRowSet.setDataSourceName. The problem I have is Sun's implementation uses a different JNDI class factory than Weblogic. I can't just get the InitialContext by doing the following:
CachedRowSet crs=new CachedRowSet();
InitialContext ic = new InitialContext();
crs.setDataSourceName("mydatasource");
crs.execute("select * from mytable");
Because Weblogic will complain (the above code will not work for CachedRowSet either).
To work under Weblogic I need to do the following:
CachedRowSet crs=new CachedRowSet();
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://127.0.0.1:7001");
InitialContext ic = new InitialContext(p);
crs.setDataSourceName("mydatasource");
crs.execute("select * from mytable");
I was able to get the InitialContext but CachedRowSet (Sun's implementation) does not know what "weblogic.jndi.WLInitialContextFactory" and "t3://127.0.0.1:7001" are and there for will throw the following exception:
java.sql.SQLException: (JNDI) Unable to connect
at sun.jdbc.rowset.RowSetReaderImpl.connect(RowSetReaderImpl.java:222)
at sun.jdbc.rowset.RowSetReaderImpl.readData(RowSetReaderImpl.java:115)
at sun.jdbc.rowset.CachedRowSet.execute(CachedRowSet.java:712)
at sun.jdbc.rowset.CachedRowSet.execute(CachedRowSet.java:1185)
at JdbcTest.main(JdbcTest.java:131)
Can any one tell me what is the right Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL are for the CachedRowSet?
Thanks a lot.
Ling.
<<Less