Olá,
estou em umprojeto WEB mas a transação é controlado via local mas vejo pela ferramenta
MYSQL Administrator que ao final da classe abaixo gera o relatório na pagina jsp
mas as conexões aberta no Banco continua lá mesmo fechando via action abaixo ???
O que será que está acontecendo ;;;;;;;;
alguém já passou por isso …
abs
String retorno = null;
String nomeRelatorio = "";
Connection con = null;
Map<String, Long> parameters = new HashMap<String, Long>();
OutputStream ops = null;
try{
//JPA
dbmanager = ServiceFactory.getInstance().getManager();
nomeRelatorio="REte001.jasper";
Session session = (Session) dbmanager.getDelegate();
con = session.connection();
String jasper = request.getContextPath()+ "/report/report/"+nomeRelatorio;
String host = "http://" + request.getServerName() + ":" + request.getServerPort();
URL jasperURL = new URL(host + jasper);
System.out.println("Host = "+host);
System.out.println("Jasper = "+jasper);
System.out.println("Getting the binary...");
response.setContentType(CONTENT_TYPE_PDF);
byte[] bytes = JasperRunManager.runReportToPdf(jasperURL.openStream(), parameters, con);
if (bytes != null) {
ops = response.getOutputStream();
System.out.println("Writting binary");
ops.write(bytes);
System.out.println("Sending report...");
ops.flush();
ops.close();
con.close();
session.close();
dbmanager.close();
}
} catch (Throwable ex) {
retorno = ERROR;
}finally{
}
return retorno;
}