TestContainers - OracleContainer - how to pass parameters to my sql files by using withCopyFileToContainer

Viewed 132

I'm copying to container my SQL directory that contains multiple sql files, the container wil execute them by alphabetical order. But i should pass parameters (schema_name) to my sql files $1

 oracleContainer.withCopyFileToContainer(MountableFile.forClasspathResource("database/scripts/"), "/container-entrypoint-startdb.d/")

How can i pass parameter to the container to execute correcty the sql files and let it executes like this @ddl.sql &1 ?

Any ideas

1 Answers

withCopyFileToContainer does nothing more than copying the files to the location you define, it is nearly equivalent to using docker cp. The gvenzl/oracle-xe supports executing shell scripts rather than SQL scripts as well, so you can use shell scripts if you need more sophisticated behavior.

Related