How to obtain jdbc conn from a client application via a remote datasource
Can anyone provide me to obtain jdbc connection from a remote JVM via a datasource (supported by a Conn pool) defined in a Sun appserver
I did the following
1. Defined Connection datapool for Oracle, and provided JNDI name. jdbc/OracleConn. Pinged the datasource and everything works
2. Assigned datasource
Now I have a Client program which needs to obtain a jdbc connection. The Client program does not run inside the JVM of the appserver (not a web app running on the appserver).
How can I obtain a reference to a Connection in the Clint program
Code Snippet
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put("java.naming.provider.url", "iiop://10.1.1.65:54625");
//54625 - reference to the port where orb-listener1 is running
InitialContext ic = new InitialContext(env);
ic.lookup("jdbc/OracleConn");
I get the following exception
javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.transora.im.batch.test.TestJDBCConnection.main(TestJDBCConnection.java:34)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java: 72)
at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
... 4 more
Kindly help..
regds,
Chiths

