I have an error in Groovy sql.executeQuery():GRAVE: Message: Operation not allowed after ResultSet closed
Hi all
I am a newbie at Bonita 7.2, struggling with displaying values, retrieved from a My SQL DB, in a custom table Widget. I need a little help, please.
I'm executin a groovy script, from Bonita 7.2 and I get an error saying: GRAVE: Message: Operation not allowed after ResultSet closed
. I don't understand it because I don't have closed the resultSet.
This is my GroovyScript:
SMSOpConfig smsOpConfig = new SMSOpConfig();
SMSOpBase.connectSMS(smsOpConfig.getDBUrl(), smsOpConfig.getDBUser(), smsOpConfig.getDBPass());
//SMSOpBase.connectSMS();
loggerJava.info("Notificacion: desc");
//+notificacionRiesgo.getDescripcion() +" , titulo: "+ notificacionRiesgo.getTitulo() +" , codigo: "+notificacionRiesgo.getCodigo(), notificacionRiesgo.getOperador(),notificacionRiesgo.getTipoOperacion(), notificacionRiesgo.getMatricula(), notificacionRiesgo.getVuelo(), notificacionRiesgo.getCallSign(), notificacionRiesgo.getModerador(), notificacionRiesgo.getEstado(), notificacionRiesgo.getObligatoriedad(), notificacionRiesgo.getIncidenciaPadre(), notificacionRiesgo.getDni(),notificacionRiesgo.getNombre(),notificacionRiesgo.getApellidos(),notificacionRiesgo.getCorreo(),notificacionRiesgo.getTipo()+" , asunto: "+notificacionRiesgo.getAsunto());
resultSet = SMSOpBase.getConn().executeQuery(consulta);
// (consulta,notificacionRiesgo.getId(),notificacionRiesgo.getDescripcion(),notificacionRiesgo.getTitulo(),notificacionRiesgo.getCodigo(), notificacionRiesgo.getOperador(),notificacionRiesgo.getTipoOperacion(), notificacionRiesgo.getMatricula(), notificacionRiesgo.getVuelo(), notificacionRiesgo.getCallSign(), notificacionRiesgo.getModerador(), notificacionRiesgo.getEstado(), notificacionRiesgo.getObligatoriedad(), notificacionRiesgo.getIncidenciaPadre(), notificacionRiesgo.getDni(),notificacionRiesgo.getNombre(),notificacionRiesgo.getApellidos(),notificacionRiesgo.getCorreo(),notificacionRiesgo.getTipo(),notificacionRiesgo.getAsunto(),new Date());
while (resultSet.next()) {
loggerJava.info("************************************** REPORTES id: " + resultSet.getInt("id") +
"entidad_reportante: " + resultSet.getString(2) +
" entidad_reportante_name: " + resultSet.getString(3));
}
// SMSOpBase.closeConnection();
loggerJava.info("#########################################################################################################script eNTRADA , scriptLeeReportes");
/*
logger.error("-----ERROR guardar en bbdd"); */
} catch (e2) {
loggerJava.error("ERROR: scriptLeeReportes Notificación de BBDD*********************************");
// loggerJava.error("Cause: "+ e2.getCause());
loggerJava.error("Message Localized: "+ e2.getLocalizedMessage().toString());
loggerJava.error("Message: "+ e2.getMessage().toString());
loggerJava.error("GetStacktrace.ToString: "+ e2.getStackTrace().toString());
}finally{
try{resultSet.close();}catch(Exception e){}
try{SMSOpBase.closeConnection();}catch(Exception e1){
loggerJava.error("ERROR: scriptLeeReportes Notificación de BBDD*********************************");
// loggerJava.error("Cause: "+ e2.getCause());
loggerJava.error("Message Localized: "+ e1.getLocalizedMessage().toString());
loggerJava.error("Message: "+ e1.getMessage().toString());
loggerJava.error("GetStacktrace.ToString: "+ e1.getStackTrace().toString());
}
}
Here is the hole StackTrace:
Thank you!!
Comments
Hi,
That's weird indeed. The code looks fine. However, how do you build your form, I wonder how you execute Groovy script in a form?
Cheers
The Groovy script is an On enter connector defined in a task and its executed when the activity is started.
I see. What value does your script return? I don't see any return in the code provided.
Thanks
Also, for this kind of operation, I would recommend to use a Database connector. They have better performance than a Groovy script connector.
Cheers
Ok, thnak you, I want to have one unique groovy script ot have many diferentes data base queries, and don't have to write many differents data base connecto,one for each query.
Thank you for your help.