T
Thomas Beer
Hi all!
On our "Sun System Application Server 8" I have defined a JDBC resource with
the JNDI name "jdbc/etPlanner". It refers to a Oracle connection pool.
Everything works fine as long as I use the JNDI name "jdbc/etPlanner" within
a web service to get a conncetion to the oracle database.
I'm doing this with the following code:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)
ctx.lookup("jdbc/etPlanner");
java.sql.Connection con = ds.getConnection();
Than I tried to do the same in a "normal" standalone java application. But a
"normal" java application doesn't know the "InitialContext".
I think I have to do something like that:
java.util.Hashtable env = new java.util.Hashtable();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"Sun_Context_Factory");
env.put(javax.naming.Context.PROVIDER_URL, "MyAppServer");
javax.naming.Context ctx = new javax.naming.InitialContext(env);
But I couldn't find the right parameter values for "Sun_Context_Factory" and
"MyAppServer".
Does anybody know the right values or a better solution?
Thanks a lot!
Best regards,
Tom
On our "Sun System Application Server 8" I have defined a JDBC resource with
the JNDI name "jdbc/etPlanner". It refers to a Oracle connection pool.
Everything works fine as long as I use the JNDI name "jdbc/etPlanner" within
a web service to get a conncetion to the oracle database.
I'm doing this with the following code:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)
ctx.lookup("jdbc/etPlanner");
java.sql.Connection con = ds.getConnection();
Than I tried to do the same in a "normal" standalone java application. But a
"normal" java application doesn't know the "InitialContext".
I think I have to do something like that:
java.util.Hashtable env = new java.util.Hashtable();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"Sun_Context_Factory");
env.put(javax.naming.Context.PROVIDER_URL, "MyAppServer");
javax.naming.Context ctx = new javax.naming.InitialContext(env);
But I couldn't find the right parameter values for "Sun_Context_Factory" and
"MyAppServer".
Does anybody know the right values or a better solution?
Thanks a lot!
Best regards,
Tom