Hi, I can not connect to a connection pool with a datasource. I can connect with the DriverManager.getConnection Method. when I try to connect using the datasource I am getting this error: java.lang.ClassCastException: weblogic.jdbc20.common.internal.RmiDataSource_ServiceStub I am trying to connect from a jsp. This is the jsp code: InitialContext initCtx = null;
Hashtable hashtable = new Hashtable(); hashtable.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory"); hashtable.put("java.naming.provider.url", _url1); initCtx = new InitialContext(hashtable); javax.sql.ConnectionPoolDataSource ds = (javax.sql.ConnectionPoolDataSource) initCtx.lookup ("myDataSource"); The entry I have in the weblogic properties is: weblogic.jdbc.connectionPool.uidaePool=\ url=jdbc racle:thin:@serv1.line.net:1521:serv,\ driver=oracle.jdbc.driver.OracleDriver,\ initialCapacity=5,\ maxCapacity=20,\ capacityIncrement=1,\ props=user=user;password=pass weblogic.jdbc.TXDataSource.myDataSource1=uidaePool weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=everyone I am going crazy with this error. If anyone has any idea about why I am getting the error I would really appreciate your input. Thank you, Rosalinde firstname.lastname@example.org
Try using javax.sql.DataSource instead of javax.sql.ConnectionPoolDataSource.
Joined: Jul 02, 2002
Hi Thanks for getting back to me. Unfortunately I have tried using javax.sql.DataSource ds and DataSource ds neither one has made a difference. Ideally I would like to use javax.sql.DataSource not javax.sql.ConnectionPoolDataSource ds. I have also tried using narrow operation: Object ref = initCtx.lookup("myDataSource1"); javax.sql.DataSource ds = (javax.sql.DataSource)PortableRemoteObject.narrow(ref,DataSource.class); and I still get the same error. Please let me know if you have any other suggestions. Thank you
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Hi Rosalinde, It looks like you are using the oracle drivers. Try instantiating the oracle.jdbc.pool.OracleDataSource object rather than the javax.sql.DataSource. I hope it should work. Cheers, Narendra.