1 Reply Latest reply on Aug 15, 2018 1:31 AM by rhn-support-abhati

    Embedded quotes prevent use of CLI to add a datasource




      I have Wildfly 10 running on Ubuntu 16.04 and I need to use the CLI command line to create a new datasource.  The problem is that the connection-url needs to look like:



      Note that there are two "parts" to the connection-url separated by a semicolon.


      If I use the CLI in interactive mode as follows there is no problem:


      >connect --controller=

      Note that here I have to enclose the connection-url value in double quotes.


      The above works as a test but what I actually need to do is accomplish the above with a single command line such as the following:


      jboss-cli.bat --commands="connect --controller=,/subsystem=datasources/data-source=MyDatasourceID:add(jndi-name=\java:jboss/datasources/MyDatasourceID,min-pool-size=1,max-pool-size=5,driver-name=Sybase,connection-url=\"jdbc:sqlanywhere:Host=,;ServerName=MyServer\",enabled=true,use-java-context=true,statistics-enabled=true,user-name=,password="

      This fails.  Note that since we are issuing all of this in a single command we have to wrap the value of commands= in double quotes.  But, we already have to wrap connection-url in double quotes.  I originally thought that this would be easily dealt with by escaping the double quotes used in connection-url but that fails.  I have tried every combination of single and double quotes and escaped single and double quotes in various locations and I always get an error message,  Based on what I am trying I get errors like:


      'ServerName' is not a valid parameter name.
      ';ServerName' is not a valid parameter name.

      These errors suggest to me that the parsing is getting confused with the quotes.


      I'm sure other's have needed to set a "multi-part" connection-url but I don't see how to get this working.


      Is this a bug.  Can someone explain how to do this?


      Thank you.

        • 1. Re: Embedded quotes prevent use of CLI to add a datasource


          Can you please try with below command :



          /jboss-cli.sh -c --commands='/subsystem=datasources/data-source=MyDatasourceID2:add(jndi-name=java:jboss/datasources/MyDatasourceID2,min-pool-size=1,max-pool-size=5,driver-name=h2,connection-url="jdbc:sqlanywhere:Host=,;ServerName=MyServer",enabled=true,use-java-context=true,statistics-enabled=true,user-name=arnav,password=arnav'



          I tried it and it works for me.

          Please let me know if it works for you as well.