Embedded quotes prevent use of CLI to add a datasource
alkoch Apr 15, 2018 5:23 PMHello,
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:
connection-url=jdbc:sqlanywhere:Host=192.168.1.16:14239,192.168.1.16:14251;ServerName=MyServer;
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:
jboss-cli.sh >connect --controller=192.168.1.22:30001 >/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=192.168.1.16:14239,192.168.1.16:14251;ServerName=MyServer",enabled=true,use-java-context=true,statistics-enabled=true,user-name=,password=
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=192.168.1.22:30001,/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=192.168.1.16:28889,192.168.1.16:28890;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. '192.168.1.16:14251;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.