Dirk, I'm sorry I didn't see the difference on the page you sent me to.
However, if there is a way I can do this without having to use jstl, I
would really like to know. I was hoping to put the code in a class
somewhere that my servlets could use.
thanks,
sean
Dirk Weigenand wrote:
>Sean,
>
>
>
>>--- Ursprüngliche Nachricht ---
>>Von: Sean Rowe <ichabooka@gmail.com>
>>An: Tomcat Users List <tomcat-user@jakarta.apache.org>
>>Betreff: Re: jndi question
>>Datum: Mon, 22 Aug 2005 09:24:10 -0500
>>
>>Thanks for responding Dirk. I've practically memorized the
>>documentation on the link you sent:
>>
>>// Obtain our environment naming context
>>Context initCtx = new InitialContext();
>>Context envCtx = (Context) initCtx.lookup("java:comp/env");
>>
>>// Look up our data source
>>DataSource ds = (DataSource)
>> envCtx.lookup("jdbc/EmployeeDB");
>>
>>// Allocate and use a connection from the pool
>>Connection conn = ds.getConnection();
>>... use this connection to access the database ...
>>conn.close();
>>
>>Whenever I try this, here's what I get (which led me to trying it the way
>>I posted):
>>
>>javax.naming.NameNotFoundException: Name java:comp is not bound in this
>>Context
>>
>>
>>
>
>No. Did you look at
>http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html?
>
>I recommend putting the context definition in its own content.xml. On
>redeploying my application tomcat wouldn't find the driver class anymore.
>
>Mind you not the class itself but the definition of what class to load.
>
>This problem was solved by putting the context into context.xml.
>
>regards
> Dirk
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
|