List of usage examples for javax.naming InitialContext lookup
public Object lookup(Name name) throws NamingException
From source file:com.portfolio.data.provider.MysqlAdminProvider.java
@Override public void connect(Properties connectionProperties) throws Exception { InitialContext cxt = new InitialContext(); if (cxt == null) { throw new Exception("no context found!"); }/* ww w .j a va 2 s .co m*/ DataSource ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/portfolio-backend"); if (ds == null) { throw new Exception("Data jdbc/portfolio-backend source not found!"); } connection = ds.getConnection(); }