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

      Hi,

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

      1. Created h2-ds.xml file and copied into
      C:\jboss-5.0.0.CR2\server\default\deploy\jca.
      2. Copied h2.jar file at following location.
      C:\jboss-5.0.0.CR2\server\default\lib
      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,
      "org.jnp.interfaces.NamingContextFactory");

      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.

      Sani