You should be storing your connection as a shared datasource, and then access that existing data source. This will require you add some code into the engine. So you can create a “camunda plugin” or just create a component in the Camunda SpringBoot distro, and setup the sql datasource to your custom DB. Then in your groovy script you load that data source Sql(...)
and execute your query.