Hi All,
Datasource is configured in server.xml file. How can I load the datasource from this file in a stand alone
java application?
If i try with
Context initialContext = new InitialContext();
DataSource dataSource = (DataSource) csDBEnvContext.lookup(DATASOURCE_NAME);
i get 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.initial
Same code when called from
jsp gets executed fine. To my understanding, in this case container plays the key role in proper execution.
Datasource name alone is shared to me. username, password are not shared since it is production environment.
Thanks