Martin,

Thanks for you reply. In fact I need to "simulate" tomcat's jndi mechanism. My 
class will be invoked by jUnit and not by tomcat. I'm trying to bind a 
datasource to a jndi name outside tomcat, but with exactaly the same names...

Thank you!

-----Mensagem original-----
De: Martin Gainty [mailto:[EMAIL PROTECTED] 
Enviada em: sexta-feira, 7 de março de 2008 11:43
Para: Milanez, Marcus
Cc: Tomcat Users List
Assunto: Re: Simultate Tomcat JNDI

Marcus-http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howt
o.html//assume you have this Oracle Datasource definition in your 
web.xml<resource-ref>  <description>Oracle Datasource example</description>  
<res-ref-name>jdbc/myoracle</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>//I can now access the predefined DataSource using jdbc/myoracle 
lookup mechanism e.g.Context initContext = new InitialContext(); Context 
envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();HTHMartin-
----- Original Message -----
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, March 07, 2008 9:08 AM
Subject: Simultate Tomcat JNDI


Hi everyone,

I'm trying to simulate tomcat's jndi mechanism, in order to test my DAO objects 
with junit. Does anybody knows how to do that? It seems to me that I need to 
bind the name java:/comp/env to a Context object and then bind my jdbc name to 
this context. Is this the way tomcat put things together? A Context object 
inside another and then the jdbc itself inside this one?

Thnaks in advance!

Marcus Milanez

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to