1 Reply Latest reply on Apr 10, 2006 1:02 PM by Reto Huber

    Scheduler and JNDI

    alexei manaev Newbie

      Hi!

      How can I get connection to DataSource from class derived from

      org.jboss.varia.scheduler.Schedulable

      using JNDI?

      Where is alternative for web.xml and jboss-web.xml?

      Thank you!

        • 1. Re: Scheduler and JNDI
          Reto Huber Newbie

          Are you looking for this piece of code?

          // get data base connection
          Context ctx = new InitialContext();
          DataSource ds = (DataSource) ctx.lookup("java:/MyDS");
          conn = ds.getConnection();
          
          // get data base driver
          Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
          
          // Execute the select
          pstmtSelect = conn.prepareStatement("SELECT * FROM MyTable");
          ResultSet rs = pstmtSelect.executeQuery();
          


          Regards,
          Reto