2 Replies Latest reply on Jan 20, 2014 3:03 PM by wdfink

    Datasource creation using cli (postgresql)

    zatopek

      hello.

      I am trying to create one DS for my postgresql database.

      My jboss is in domain mode , using the profile full-ha

      i have run the domain and using cli i am trying to create the da :

      1.- this is my modules.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="org.postgresql">

        <resources>

          <resource-root path="postgresql-9.2-1003.jdbc4.jar"/>

        </resources>

        <dependencies>

          <module name="javax.api"/>

          <module name="javax.transaction.api"/>

        </dependencies>

      </module>

      into the dir i have put the jar driver file

      2.- i connect to the server:

      jboss-cli.bat  --connect controller=192.168.1.55r:9999 --user=admin --password=password

       

      3.- i try to create the ds:

      /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

       

      appears one error:

      [domain@192.168.1.55:9999 /] /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

       

      Failed to get the list of the operation properties: "JBAS014883: No resource definition is registered for address [

          ("subsystem" => "datasources"),

          ("jdbc-driver" => "postgresql")

      ]"

       

      Can you help me please?

       

      thanks

        • 1. Re: Datasource creation using cli (postgresql)
          runeks2

          When using domain, you need to specify which profile (in domain.xml) the jdbc-driver should be added to.  The following command

           

          /profile=default/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

           

          adds a jdbc-driver to the default profile.

          • 2. Re: Datasource creation using cli (postgresql)
            wdfink

            As he use the "full-ha" profile the command is

            /profile=full-ha/subsystem=datasources......


            Also you need to add the module to the "modules/org/postgresql/main" directory.

            Tip: you might create the module with the CLI but you need to have the "module add ..." command with the CLI disconnected as it works only connected if there is a standalone server