AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sun App. Server,JDBC resource, JNDI

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Thomas Beer
Guest





PostPosted: Thu Jan 13, 2005 1:11 pm    Post subject: Sun App. Server,JDBC resource, JNDI Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.