How to access DataSource object without 'java:/comp/env/' prefix in lookup method? -
since jndi resource named jdbc/mydb declared inside tomcat server/context.xml, can access datasource in following way:
context initcontext = new initialcontext(); datsource datasource = (datasource)initcontext.lookup("java:/comp/env/jdbc/mydb");
is possible, config trick in .xml , by:
datasource datasource = (datasource)initcontext.lookup("jdbc/mydb");
without java:/comp/env/ prefix in lookup method?
Comments
Post a Comment