I'm attempting to create a small Springboot application that uses the groovy.sql.Sql class to connect to an Oracle database(the Oracle jar has already been grabbed and is in the spring boot classpath). This is a very simple example for proof of concept/testing.
import groovy.sql.Sql
@RestController
class ThisWillActuallyRun {
@RequestMapping("/")
String home() {
oracleSql = Sql.newInstance(jdbc:oracle:thin:@oracle-db:1521:db-name,
"oracle-user",
"oracle-pass",
"oracle.jdbc.driver.OracleDriver")
row = oracleSql.firstRow("select foo from blah")
return "ok"
}
}
When the application is ran using the command:
spring run test_for_so.groovy
The following error is produced:
startup failed:
file:test_for_so.groovy: 1: unable to resolve class groovy.sql.Sql @ line 1, column 1.
import groovy.sql.Sql