// URL as DataSource URL and lookup it in the JNDI.
DataSource dataSource;
try {
dataSource = (DataSource) new InitialContext().lookup(JNDI_ROOT + url);
} catch (NamingException e) {
throw new DAOConfigurationException("DataSource '" + url + "' is missing in JNDI.", e);
}
DataSourceDAOFactory dataSourceDAOFactory = DataSourceDAOFactory.getInstance(dataSource);
instance = dataSourceDAOFactory;
} else {
throw new DAOConfigurationException("Database name is null.");
}
}
return instance;
}