Hi,
I guess it is very trivial, but I'm new to this and I can't get it to
work.
Basically I want to create a JdbcDataSource to create a connection.
But I guess the "javax.naming.NoInitialContextException" error at this
line: ctx.bind("jdbc/dsName", ds);
Can someone please explain to me what it means and how it can e
resolved. The code and error are listed below. Sorry for the basic
question and thanks you for your help.
Valeh
JdbcDataSource ds;
public void createDataStore() {
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:˜/test");
ds.setUser("sa");
ds.setPassword("");
Context ctx = null;
try {
ctx.bind("jdbc/dsName", ds);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
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
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:
288)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:
325)
at javax.naming.InitialContext.bind(InitialContext.java:400)
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.