External lookup for Tomcat JNDI

Viewed 20

I want to configure a datasource within Tomcat 9.x and access it from the outside world. From the early days of my development career I can remember, that you have to pass some properties on creation of the InitialContext and then it worked well.

        Properties props = new Properties();
        props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.naming.java.javaURLContextFactory");
        props.setProperty(Context.PROVIDER_URL,"????????");
        InitialContext ctx = new InitialContext(props);

        DataSource ds  = (DataSource) ctx.lookup("java:jdbc/ordering");
        Connection conn = ds.getConnection();

No glue, whether it is possible under Tomcat ...

Any help appreciated and thx in advance.

0 Answers
Related