• Documentation
  • Tutorials
  • Blogs
  • Product

What's on this Page

  • Select For Update (atomic transaction)
  • Copy a file from a path to another
  • REST call with JSON response
  • Step
  • Libraries
  • Groovy library
Categories: LIBRARIES GROOVY
This article references one of our previous releases, click here to go to our latest version instead.

Groovy library

Select For Update (atomic transaction)

Below an example of Groovy script used to open an sql connection, update a column of the first row of a table, then close the connection.

sql = groovy.sql.Sql.newInstance('jdbc:mysql://localhost/step','step','init')
sql.execute('begin')
sql.firstRow('select myColumn from myTable for update')[0]
sql.execute('update myTable set myColumn = myColumn + 1');
sql.execute('commit')
sql.close()

Copy a file from a path to another

java.nio.file.Files.copy(java.nio.file.Paths.get(file), java.nio.file.Paths.get(file+'2'))

REST call with JSON response

response = new URL("http://localhost:8080/rest/grid/agent").text
json = new com.fasterxml.jackson.databind.ObjectMapper().readValue(response, Class.forName('java.util.List'))
  • Home
  • Whats new?
  • Release Strategy
  • Set up
  • Administration
  • SaaS guide
  • User guide
  • Developer guide
  • DevOps
  • Plugins
  • Libraries
    • Plan library
    • Groovy library
Step Logo
    • Documentation
    • Tutorials
    • Blogs
    • Product
    • Home
    • Whats new?
    • Release Strategy
    • Set up
    • Administration
    • SaaS guide
    • User guide
    • Developer guide
    • DevOps
    • Plugins
    • Libraries
      • Plan library
      • Groovy library