I want to use \'DBCPConnectionPoolLookup\' controller service in \'ExecuteGroovyScript\' processor. I set \'database.name\' But I get this Error:
This
I used CTL object and edited the code to solve the problem:
import groovy.sql.Sql
flowFile = session.get()
if(!flowFile) return
def dbConnection = CTL.db.getConnection(flowFile.getAttributes())
def clientDb = new Sql(dbConnection)
try {
def RawData =flowFile.read().getText("UTF-8")
def JobId = flowFile.ExtractJobId
def params = [RawData,JobId]
def result = clientDb.executeInsert("INSERT INTO ExtractFiles (RawData,JobId,CreateTimestamp,UpdateTimestamp) VALUES (?,?,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)",params)
flowFile.'ExtractFileId' = result[0][0]
REL_SUCCESS << flowFile
} catch (Exception e) {
throw e;
} finally {
clientDb.close();
}
I added clientDb.close() as @daggett said in comments.