You must invoke lookup() on a new context: that you get through ctx.lookup("java:comp/env") that is: Context ctx = new InitialContext(); Context env = ctx.lookup("java:comp/env"); javax.sql.ConnectionPoolDataSource ds= (javax.sql.ConnectionPoolDataSource) ctx.lookup("jdbc/tdcconn"); > Hi! > Got a serious problem to define and use a Resource in Tomcat 4.0.1. > I want to define in the Tomcat a JNDI resource like this (server.xml) under > my webapplication (<context.......> </context>) > > <Resource name="jdbc/tdcconn" auth="Container" > type="javax.sql.ConnectionPoolDataSource"/> > <ResourceParams name="jdbc/tdcconn"> > <parameter> > <name>user</name> > <value>tdc</value> > </parameter> > <parameter> > <name>password</name> > <value>tdc</value> > </parameter> > <parameter> > <name>driverClassName</name> > > <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> > </parameter> > <parameter> > <name>driverName</name> > > <value>jdbc:microsoft:sqlserver://ramirez:1433</value> > </parameter> > </ResourceParams> > > And in the web.xml for my webapplication I´vd declared the resource li ke > this: > > <resource-ref> > <description>Try connection pool with fucking > MS</description> > <res-ref-name>jdbc/tdcconn</res-ref-name> > <res-type>javax.sql.ConnectionPoolDataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > In my JSP code I try to access the resource like this: > > javax.naming.InitialContext ctx= new javax.naming.InitialContext (); > ctx.lookup("java:comp/env"); > javax.naming.NamingEnumeration enum= ctx.list("java:comp/env"); > ds= (javax.sql.ConnectionPoolDataSource) ctx.lookup ("jdbc/tdcconn"); > > > And the exception comes out like this: > > javax.naming.NameNotFoundException: Name jdbc is not bound in th is > context..... > > > Any suggestions > > Niclas Rothman > > > > Niclas Rothman > System Developer > > e|sense > Øster Fælled Torv 4 > DK-2100 Copenhagen > Denmark > > +45 35 44 17 00 - reception > +45 35 44 17 21 - direct > +45 35 44 17 17 - fax > > [EMAIL PROTECTED] > www.e-sense.dk > > e|sense - a Kunde Group company > > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> > >