Sun App. Server, JDBC, JNDI

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top