Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with datasource

2 views
Skip to first unread message

teno

unread,
Oct 23, 2005, 3:35:13 AM10/23/05
to
hi all,


im trying to connect to db2 database using datasource and jndi from
jdeveloper 10g using the following code:


Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,


"com.sun.jndi.cosnaming.CNCtxFactory");


env.put(Context.PROVIDER_URL,
"http://localhost:8888");


Context initialContext = new InitialContext(env);


Object o = initialContext.lookup("jdbc/sampleDS");


DataSource ds=(DataSource)o;
con=ds.getConnection();
stmt = con.createStatement();
rst = stmt.executeQuery("select MEGAILY.EMPLOYEE.LASTNAME from
MEGAILY.Employee where MEGAILY.EMPLOYEE.EMPNO='000010' ");


but i have the following exception when i try to run this code :


javax.naming.ConfigurationException: http://localhost:8888 does not
contain an IOR


at
com.sun.jndi.cosnaming.CNCtx.getStringifiedIor(CNCtx.java:421)


at
com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:198)


at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)


at
com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)

at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)

at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)


at javax.naming.InitialContext.init(InitialContext.java:219)


at javax.naming.InitialContext.<init>(InitialContext.java:195)


at mypackage.Class2.main(Class2.java:72)


Process exited with exit code 0.


i dont know what is wrong please any one help me


thanks

DMX

unread,
Oct 24, 2005, 4:48:28 PM10/24/05
to
Is that your Appserver's rmi/bootstrap port? 8888
Sounds like some generic "example" port.
I think 2810 is the default for WAS's server1....

Later.

0 new messages