I have made some small improvements to the JUnit JNDI DataSource helper package:
http://www.javaranch.com/CodeBarn/jrunittesthelper.zip How can I contribute it back to the CodeBarn ?
Updates include:
- Built using maven2
- Opens the properties file using classpath
- Works with environment naming context ( see below example )
// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:comp/env");
// Look up our data source
DataSource ds = (DataSource)envCtx.lookup("jdbc/EmployeeDB");