tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Name jdbc is not bound in this Context
Date Thu, 09 Sep 2004 14:00:00 GMT


>I'm getting this error " Name jdbc is not bound in this Context" on my
>application. My tomcat version is 5.0.27.
>The servlet that is causing this error is trying to access a database
>with the following code:
>protected IDatabaseConnection getConnection() throws Exception {
>        Context ic = new InitialContext();
>        Context ctx = (Context) ic.lookup("java:comp/env");
>        DataSource ds = (DataSource) ic.lookup("jdbc/boxes-cactus");
>        con = new DatabaseDataSourceConnection( ds);
>        return con;

Sometimes people miss the basic things: how about ctx.lookup instead of
ic.lookup on the 2nd call? ;)


This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message