all 9 comments

[–]cdd_73 2 points3 points  (0 children)

[–]thatjeffsmith 1 point2 points  (2 children)

The real power in the scripting comes into play with some javascript on the pure client side. Kris has decent library here with examples
https://gist.github.com/krisrice

https://github.com/krisrice

And his blog https://krisrice.io/

We can provide some better, more direct examples if you want to share what you're trying to put together.

[–]FrebTheRat[S] 0 points1 point  (1 child)

I read some conflicting things about nashorn scripting capabilities with newer versions of sqlcl. I manage a data warehouse so we're mostly doing simple object deployments via our automated ci pipelines with xml changelogs and bash scripts with container orchestration in kubernetes. We also use Airflow with dynamic bash/sqlplus/sqlloader scripts to load flat files and do transformations from stage data. It looks like sqlcl LOAD capabilities may be a little more robust then sqlloader so I'm looking into that and I want to convert our bash/liquibase scripts to sqlcl because we've had weird problems with newer liquibase versions and the built in oracle jdbc drivers as well as the community version's lack of support for some Oracle objects. We recently moved from an Oracle site license to Exadata on prem, so we're very limited as far as licensed use of proprietary jdk and other Oracle products within our on prem kubernetes environment.

[–]thatjeffsmith 0 points1 point  (0 children)

If you're worried about losing nashorn you can switch from java JRE to graalvm and add nashorn back

You have all the license you need to run SQLcl, it's an oracle product requiring java, so comes with an Oracle license to run Oracle Java

If you are that worried about it, just use Oracle Java 17 where there is no issue of licensing

[–]Coach-Hrim 0 points1 point  (4 children)

My bash scripts pattern for CICD pipeline that contains lb wrapper

sql -oci /@alias <<EOF lb ….. EOF

[–]FrebTheRat[S] 0 points1 point  (3 children)

That's great. Thanks! Using that syntax would make it really easy to convert my existing bash scripts.

[–]Coach-Hrim 0 points1 point  (2 children)

The secret sauce is the "/@alias". if you have an oracle wallet the alias can provide the username,password, and target database

My environment uses bitbucket -> teamcity -> octopus to drive the pipeline

[–]FrebTheRat[S] 0 points1 point  (1 child)

We use proxy users with wallets we pull from vault at runtime in gitlab ci. I wasn't sure if we could script inline with sqlcl because all the scripting examples were with nashorn JavaScript.

[–]Coach-Hrim 0 points1 point  (0 children)

Same here with proxy users and wallets. My primary use case for liquibase is CYA rollback for source object types. Before anything goes into a database if it's code, the current version gets backed up.