I created a
Java applet with the following code to connect to a DB2 database.
************************
Context initial = null;
DataSource ds= null;
try
{
initial = new InitialContext();
ds = (DataSource) initial.lookup("java:comp/env/xroller");
}
catch (NamingException e1)
{
e1.printStackTrace();
}
************************
However, I'm now trying to use the same code in a Java application, and i'm getting the following exception:
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.initialat javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
atjavax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
at javax.naming.InitialContext.lookup(InitialContext.java:359
I'm at a loss for why this is happening since it works fine in the applet, does anyone have any ideas.
I really appreciate anyone's help.
Thanks,
Mike