Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemanth22/3aeea56954145e891e34b80db0616fa6 to your computer and use it in GitHub Desktop.
Save hemanth22/3aeea56954145e891e34b80db0616fa6 to your computer and use it in GitHub Desktop.
Access Oracle Database with Groovy
import groovy.sql.Sql
// Oracle DB Settings
def dbSchema = ‘schema’
def dbServer = ‘oracleserver’
def dbUser = ‘user’
def dbPassword = 'password'
def dbDriver = 'oracle.jdbc.driver.OracleDriver'
def dbUrl = 'jdbc:oracle:thin:@' + dbServer + ':' + dbSchema
sql = Sql.newInstance( dbUrl, dbUser, dbPassword, dbDriver )
// Read data
def row = sql.firstRow("SELECT * FROM application_configuration WHERE application_name = ${gitProjectName}")
println row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment