5 Replies Latest reply: Nov 14, 2011 9:05 AM by Daniel Bevenius RSS

    DataSource creation using Java API

    Daniel Bevenius Master

      Hi,

       

      I've been using the Java Management API to create a datasource and noticed that the 'enabled' attribute is set to false, even if I specify it.

      This is what I'm doing:

      ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getByName("localhost"), 9999, callbackHandler);
      ModelNode op = new ModelNode();
      op.get("operation").set("add");
      ModelNode address = op.get("address");
      address.add("subsystem", "datasources");
      address.add("data-source", dsname);
      op.get("jndi-name").set("java:jboss/datasources/" + dsname);
      op.get("driver-name").set("h2");
      op.get("enabled").set(true);
      op.get("pool-name").set("MigrateDS");
      op.get("connection-url").set("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
      ModelNode retVal = client.execute(op);
      

      This will create a disabled datasource when executed. Looking at line 143 of AbstractDataSourceAdd the enabled attribute is overwritten and set to false:

       

       modelNode.get(ENABLED.getName()).set(false);
      

       

      Was there an issue with enabling a datasource when using the Java API?

       

      Thanks,

       

      /Daniel