Using DbSchema you can automate different processes using JScript or Groovy scripts. Groovy is known for being used in Gradle, is simple and fully Java compatible. The scripts can be edited and tested in the SQL Editor.

Groovy is a pure Java scripting language, with support for closures and lambda as below. Notice the variables in ${...} are replaced in GStrings.

sql.eachRow("select * from address") { r ->
    println "Gromit likes ${r.address_id}"
String multiline = """I am a multiline

From Groovy you can access most of the DbSchema classes and methods. Details in DbSchema API.

The following variables are exposed directly to the Groovy script engine :
sql The physical connection to the database.
project The DbSchema project, with schemes, tables, columns, etc..
out The PrintStream out console output stream, visible in the Script Result Pane.

DbSchema can start in console mode and execute a given Java Groovy script using: Dbschema.exe -x <path-to-script>.

DbSchema can be stated in headless mode ( no splash screen ) using java -cp "lib/*" com.wisecoders.dbs.DbSchema -x path_to_sample_script When adding further parameters to the command, the parameters will be visible in the script using the variable parameters as array.

Sample Groovy Scripts

Please don't hesitate to ask us on Help/Report Bug menu option for more samples or published classes or methods.