OH3 executeCommandLine with mysql not working after migration in rules

IN OH 2.5.11 I had a few rules using mysql directly from rule with old Syntax off CommandLine:

var String sql_query = "/bin/sh@@-c@@mysql -h localhost -u OHSQLUSER -pPASSWORD - e "SELECT…; -D “openhab2”
var String mysql = executeCommandLine(sql_query, 5000)

This works fine in OH 2.5 getting the result table in the String

During Migration I changed the Syntax as mentioned in migration-guidelines to

var String mysql = "executeCommandLine(Duration.ofSeconds(5), sql_query)

But this doesn’t work with mysql (Other .sh-Scripts the change in Syntax works, but not with mysql)


2021-01-10 01:29:00.513 [INFO ] [ab.core.model.script.SQL-Maintenance] - Check Amount of mysql-Data
2021-01-10 01:29:00.516 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine ‘[/bin/sh@@-c@@mysql -h localhost -u USER -pPASSWORD -e “SELECT sum(TABLE_ROWS) AS Data FROM information_schema.TABLES where TABLE_SCHEMA like ‘openhab2’;” -D openhab2]’
2021-01-10 01:29:00.517 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘98_Smarthome_Status-9’ failed: cannot invoke method public java.lang.String[] java.lang.String.split(java.lang.String) on null in 98_Smarthome_Status

First INFO comes from Rule,
WARN is the error I didnt get solved
ERROR is only because the String is null due to problem with executeCommandLine

Any idea, what I did wront with executeCommandLine? Or how to solve?

the easiest way would be to simplify your query string. put your string into the sh file and just pass variables to that sh file.
This way you don’t have to worry about correct usage of “” characters within your string.
furthermore the syntax now is different and I think you need to provide each paramter separately like:

executeCommandLine(Duration.ofSeconds(5), "/bin/sh", "-c", "mysql", "-h", ...).

Thanks, I knew the Syntax changed, but didn’t expect more changes as Timeout at beginning.

This works:

executeCommandLine(Duration.ofSeconds(5), "/bin/sh", "-c", "mysql -h .........")

So not everything has to put in a block, just delimit sh, parameter and mysql-command is enough!

Thank you for your help