We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

narkisr on 01/15/08


Tagged

java j2ee JBoss


Versions (?)


JBoss Default DS usage


Published in: Java 


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

  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 

You need to login to post a comment.