Sun App. Server,JDBC resource, JNDI

From: Thomas Beer (keineEMail_at_www.de)
Date: 01/13/05


Date: Thu, 13 Jan 2005 14:11:13 +0100

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
 



Relevant Pages

  • Sun App. Server, JDBC, JNDI
    ... It refers to a Oracle connection pool. ... Everything works fine as long as I use the JNDI name "jdbc/etPlanner" within ... Than I tried to do the same in a "normal" standalone java application. ...
    (comp.lang.java.programmer)
  • Sun App. Server 8, JDBC resources, JNDI
    ... It refers to a Oracle connection pool. ... Everything works fine as long as I use the JNDI name "jdbc/etPlanner" within ... Than I tried to do the same in a "normal" standalone java application. ...
    (comp.sys.sun.apps)