Hi Patrick, in which context you want to use JNDI? This works properly only in the context of an application server (Tomcat, WildFly, WebLogic, GlassFish, ...). Otherwise you have to code your own JNDI container.
Best, Manfred Am Dienstag, 5. Dezember 2017 05:31:12 UTC+1 schrieb Patrick H: > > Hello, > > Are there any jndi.properties file examples available? > > For example code ( > http://www.h2database.com/javadoc/org/h2/jdbcx/JdbcDataSource.htm) doesn' > work. > > import org.h2.jdbcx.JdbcDataSource; > import javax.naming.Context; > import javax.naming.InitialContext; > JdbcDataSource ds = new JdbcDataSource(); > ds.setURL("jdbc:h2:˜/test"); > ds.setUser("sa"); > ds.setPassword("sa"); > Context ctx = new InitialContext(); > ctx.bind("jdbc/dsName", ds); > > > > line: ctx.bind(...) throws 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.initial > > > Thanks, > > Patrick > > > > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
