Connecting Tech Pros Worldwide Forums | Help | Site Map

Regarding connection pooling

kaleeswaran's Avatar
Familiar Sight
 
Join Date: Mar 2007
Location: comibatore
Posts: 132
#1: Mar 18 '08
hi !

i am doing connection pooling.i am facing an exception like:

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial


i tried to debug my code it showing error there:

ds = (DataSource) ctx.lookup("java:comp/env/DB Name");

i don't what is the problem..
can you give me some idea..
thanks ,
kaleeswaran

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Mar 18 '08

re: Regarding connection pooling


Quote:

Originally Posted by kaleeswaran

hi !

i am doing connection pooling.i am facing an exception like:

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial


i tried to debug my code it showing error there:

ds = (DataSource) ctx.lookup("java:comp/env/DB Name");

i don't what is the problem..
can you give me some idea..
thanks ,
kaleeswaran

How are you obtaining the context?
kaleeswaran's Avatar
Familiar Sight
 
Join Date: Mar 2007
Location: comibatore
Posts: 132
#3: Mar 18 '08

re: Regarding connection pooling


Quote:

Originally Posted by r035198x

How are you obtaining the context?


InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/MySqlDS");
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#4: Mar 18 '08

re: Regarding connection pooling


Quote:

Originally Posted by kaleeswaran

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/MySqlDS");

Get fscontext.jar and read about how to use it.
Reply