2 Replies Latest reply on Feb 17, 2009 9:00 PM by Shah din sani

    How to use H2 database from Jboss

    Shah din sani Newbie


      I am trying to configure H2 database from Jboss and have done following.

      1. Created h2-ds.xml file and copied into
      2. Copied h2.jar file at following location.
      3. Now when i start my server i see following message in console.
      Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=H2DS' to JNDI name 'java:H2DS'

      However, when i try to connect using following code.

      Properties properties = new Properties();
      properties.setProperty InitialContext.INITIAL_CONTEXT_FACTORY,

      properties.setProperty(InitialContext.PROVIDER_URL, "jnp://localhost");

      InitialContext ic = new InitialContext(properties);

      Connection con = null;
      if (ic != null) {
      DataSource ds = (DataSource) ic.lookup("H2DS");
      con = ds.getConnection();

      I am getting following error.
      21:44:22,389 INFO [STDOUT] Error Data : H2DS not bound

      Please advice.