6 Replies Latest reply on Sep 7, 2011 10:45 AM by rareddy

    Create datasource using CLI

    rareddy

      Can somebody post a sample on how to create a data source using CLI? I checked Admin Guide, did not see any example. The help says, run command "data-source", it was not much help on what parameter it needs,  looks like you can ask for "operation-description for the command.  Can somebody give small example?

       

      Then I tried something like

       

      /subsystem=datasources/data-source=java\:/TestDS:add(jndi-name=java:/TestORCL, connection-url= jdbc:oracle:thin:@server:1521:orcl, driver-name=oracle, user-name=myuser, password=pass, pool-name=testorcl)
      

       

      given my driver module "oracle" is deployed already, this succeeds. Now I do not see the data source created in the admin-console right away after refresh, I had to restart the server before I can see it.

       

      I had my user-name set wrong on the data source, so I used admin-console to update the user-name and saved it. But the changes did not take effect either. Is there a refresh or persistence issue with admin-console.

       

      Thanks

       

      Ramesh..

        • 1. Re: Create datasource using CLI
          beve

          Hi,

          Can somebody post a sample on how to create a data source using CLI?

          The following example can be found on this page, if you scroll down you find this example in the section "Deploying a Datasource":

           

          /subsystem=datasources/data-source=MigrateDS:add(jndi-name=java:jboss/datasources/MigrateDS, pool-name=MigrateDS, driver-name=h2, connection-url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1)
          

           

          Regards,

           

          /Daniel

          • 2. Re: Create datasource using CLI
            rareddy

            This command is similar to one I posted. I see there is command called "data-source" in CLI, how can one use this command to create a data source?

             

            Thank you.

             

            Ramesh..

            • 3. Re: Create datasource using CLI
              beve

              see there is command called "data-source" in CLI, how can one use this command to create a data source?

              You can get a listing of the available options by running:

              [standalone@localhost:9999 /] data-source add --help
              
              • 4. Re: Create datasource using CLI
                rareddy

                Daniel,

                 

                Thank you very much. I never thought to put those two together the way you have showed.

                 

                I think it would have helped from the usability perspective, if the comment said that there are extensions to the command like "data-source [add|remove|modify]" to help. Or even when I issued "data-source" command print out some helpful message to show the usage rather than saying "--jndi-name" is missing, which is confusing, not helpful.

                 

                Also another observation is, for creating a queue, CLI has "add-jms-queue", "remove-jms-queue" etc, where are "data-source" takes another approach for extensions to same command, which is not consistent across the commands in the CLI.

                 

                I would be happy write up a enhancement request if anybody agrees.

                 

                Thanks.

                 

                Ramesh..

                • 5. Re: Create datasource using CLI
                  jaikiran

                  Ramesh Reddy wrote:

                   

                  Also another observation is, for creating a queue, CLI has "add-jms-queue", "remove-jms-queue" etc, where are "data-source" takes another approach for extensions to same command, which is not consistent across the commands in the CLI.

                   

                  I would be happy write up a enhancement request if anybody agrees.

                   

                  Thanks.

                   

                  Ramesh..

                  IMO, having them consistent makes sense. So a feature request looks right.

                  • 6. Re: Create datasource using CLI
                    rareddy