 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Thomas Beer Guest
|
Posted: Thu Jan 13, 2005 1:11 pm Post subject: Sun App. Server,JDBC resource, JNDI |
|
|
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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|