This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In web application, we can connect to the database by supplying the configuration details in server.xml or context.xml. Is it possible to achive the same thing in a stand-alone application? I am getting the below exception while running an stand-alone application:
Cannot get connection: 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
From the description it is clear that the configutarion detail need to be provided in the form of environment or system property or through the application resource file java.naming.factory.initial. Tried to get the solution in the web, but didn't got the result.
Thanks Jeanne for making me know about another interesting feature of JDBC. If I am not wrong, I have to use Tomcat DBCP feature (by using the jars - commons-pool-x.x.x.jar and commons-dbcp-x.x.jar and getting an instance of the class BasicDataSource) for this purpose.
But still I am hunting for the answer with the JNDI setup.