JBoss Default DS usage


/ Published in: Java
Save to your folder(s)

This is a simple lookup and usage of the default DS in JBoss


Copy this code and paste it in your HTML
  1. InitialContext ictx = null;
  2. try {
  3. ictx = new InitialContext();
  4. final DataSource dataSource = (DataSource)ictx.lookup("java:/DefaultDS");
  5. final JdbcTemplate template = new JdbcTemplate(dataSource);
  6. // do your work here
  7. } catch (Exception e) {
  8. log.error("..");
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.