| Author |
connect to oracle through connection pool, DataSource
|
mali djuro
Greenhorn
Joined: Oct 20, 2003
Posts: 3
|
|
Hi, all last few days i tried to make connection on database through connection pool. the code i used is: <% ... String error = null; try{ error = "Setting property..."; java.util.Properties params = new java.util.Properties(); params.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); error = "Initializing InitialContext..."; javax.naming.Context ctx = new javax.naming.InitialContext(params); error = "getting DataSource..."; javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/myDS"); error = "getting connection..."; java.sql.Connection conn = ds.getConnection(username, password); System.out.println("DataSource works!!"); } catch (Exception e){ System.out.println(error + e); } ... %> i used variable error to detect where is problem. when i start this application on Websphere server 4.0 i got following exception: Initializing InitialContext... javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory [Root exception is java.lang,ClassCastException] if you have some ideas, or you have sollution, please help. thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56549
|
|
I think you'll get more pertinent response in the Webspere forum, so I'm going to move this topic along there. bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: connect to oracle through connection pool, DataSource
|
|
|