I had a few issues connecting Groovy to Oracle.
I tried grabbing ojdbc14.jar using
https://mvnrepository.com/artifact/com.oracle/ojdbc14/10.2.0.3.0
// https://mvnrepository.com/artifact/com.oracle/ojdbc14
@Grapes(
@Grab(group='com.oracle', module='ojdbc14', version='10.2.0.3.0')
)
but it did not find the file.
I copied ojdbc14.jar from my Oracle Client Directory to %GROOVY_HOME%\lib and it worked like a charm. I am sure you can download the ojdbc14.jar from the internet if you don't have the Oracle SQL Client Installed.
copy C:\DevSuiteHome_1\jdbc\lib\ojdbc14.jar C:\groovy-2.4.11\lib
url= "jdbc:oracle:thin:@localhost:1521:SID"
username = "un"
password = "pw"
driver = "oracle.jdbc.driver.OracleDriver"
// Groovy Sql connection test
import groovy.sql.*
sql = Sql.newInstance(url, username, password, driver)
try {
sql.eachRow('select sysdate from dual'){ row ->
println row
}
} finally {
sql.close()
}
Hope that helps.