好的,我运行线程,当我选择“ 0”时,必须为这两个if语句运行代码。我收到此消息后,他第一次跑了 java.sql.SQLException:连接已经关闭jdeveloopers
所以他不会第二次跑
如果没有,我尝试再次打开两者之间的连接
am1 = Configuration.createRootApplicationModule(amDef1,config1);
public void run() {
// in this lines i opoen my connection modules
在iam之后转到两个if语句//
if (dprol.equals("1") || dprol.equals("0")) {
//LOOP FOR LANGAUAGE SET
for (i = 0; i < 2; i++) {
p = 0;
ViewObject q = amcomphd2.findViewObject("distinctDCompHDView1");
ViewObjectImpl rows =(ViewObjectImpl)q;
rows.setApplyViewCriteriaName("distinctDCompHD2portal");
rows.setNamedWhereClauseParam("bindyr", yr);
rows.setNamedWhereClauseParam("bindmm", mm);
// rows.setNamedWhereClauseParam("bindprol", p);
rows.setNamedWhereClauseParam("salcat", 0);
rows.executeQuery();
/*
ViewObject rows =
VariableExecutionThread.findRowsByValueVo2("ProlAppModuleDataControl", "distinctDCompHDView1",
"Yr", yr, "Mm", mm, "CdProl", p, "CdSalCat", 0); */
Map<String, String> parameters2 = new HashMap<String, String>();
String langu = null;
langu = String.valueOf(i);
parameters2.put("langu1", langu);
while (rows.hasNext()) {
Row row = rows.next();
if (row != null) {
if (row.getAttribute("CdPers") != null) {
Integer persName = (Integer) row.getAttribute("CdPers");
//Object persOrg = (Object) o;
String persYr = (String) row.getAttribute("Yr");
String persMm = (String) row.getAttribute("Mm");
Integer persProl = (Integer) row.getAttribute("CdProl");
String persUser = username;
System.out.println(persName);
System.out.println(persProl);
String pers = null;
pers = String.valueOf(persName);
String prol = null;
prol = String.valueOf(persProl);
String orgg = null;
// orgg = String.valueOf(persOrg);
String reportid = "EMLP_REPORT";
parameters2.put("pers1", pers);
parameters2.put("orgg1", org);
parameters2.put("persYr1", persYr);
parameters2.put("persMm1", persMm);
parameters2.put("prol1", prol);
parameters2.put("persUser1", persUser);
parameters2.put("reportid", reportid);
ViewObject pV = am1.findViewObject("SecReportsView1");
ViewObjectImpl voReport =(ViewObjectImpl)pV;
voReport.setApplyViewCriteriaName("SecReportsViewCriteriaPortal");
voReport.setNamedWhereClauseParam("FileName", reportid);
voReport.executeQuery();
Row rowReport = null;
rowReport = voReport.getAllRowsInRange()[0];
String reportPath = null;
if (rowReport != null) {
reportPath = (String) rowReport.getAttribute("ReportPath");
}
parameters2.put("ReportPath", reportPath);
//////////////////////////////
ViewObject kk = am1.findViewObject("SecUserBusinessView1");
ViewObjectImpl userrow =(ViewObjectImpl)kk;
userrow.setApplyViewCriteriaName("SecUserBusinessViewCriteria");
userrow.setNamedWhereClauseParam("pers", pers);
userrow.executeQuery();
Row[] userRows = userrow.getAllRowsInRange();
if (userRows.length > 0) {
Row row3 = userRows[0];
row3.getAttribute("UserId");
String userid = null;
userid = String.valueOf(row3.getAttribute("UserId"));
parameters2.put("userid1", userid);
}
showReportPortal(parameters2);
}
} else {
System.out.println("empty1");
}
} //end while loop
//} //0,3 prol
} //end for loop
//uppal
}
am1 = Configuration.createRootApplicationModule(amDef1, config1);
if (dprol.equals("2") || dprol.equals("0")|| (dprol.equals("3"))) {
//LOOP FOR LANGAUAGE SET
for (i = 0; i < 2; i++) {
ViewObject empV = amcomphd.findViewObject("distinctDCompHDView1");
ViewObjectImpl empVO =(ViewObjectImpl)empV;
/* ViewObjectImpl empVO =
(ViewObjectImpl) Utilities.getViewObject("ProlAppModuleDataControl", "distinctDCompHDView1"); */
empVO.setApplyViewCriteriaName("distinctDCompHDViewCriteria");
empVO.setNamedWhereClauseParam("bindyr", yr);
empVO.setNamedWhereClauseParam("bindmm", mm);
empVO.executeQuery();
Map<String, String> parameters2 = new HashMap<String, String>();
String langu = null;
langu = String.valueOf(i);
parameters2.put("langu1", langu);
while (empVO.hasNext()) {
Row row = empVO.next();
if (row != null) {
if (row.getAttribute("CdPers") != null) {
Integer persName = (Integer) row.getAttribute("CdPers");
//Object persOrg = (Object) o;
String persYr = (String) row.getAttribute("Yr");
String persMm = (String) row.getAttribute("Mm");
Integer persProl = (Integer) row.getAttribute("CdProl");
String persUser = username;
System.out.println(persName);
System.out.println(persProl);
String pers = null;
pers = String.valueOf(persName);
String prol = null;
prol = String.valueOf(persProl);
String orgg = null;
// orgg = String.valueOf(persOrg);
String reportid = "EMM_REPORT";
parameters2.put("pers1", pers);
parameters2.put("orgg1", org);
parameters2.put("persYr1", persYr);
parameters2.put("persMm1", persMm);
parameters2.put("prol1", prol);
parameters2.put("persUser1", persUser);
parameters2.put("reportid", reportid);
ViewObject pV = am1.findViewObject("SecReportsView1");
ViewObjectImpl voReport =(ViewObjectImpl)pV;
voReport.setApplyViewCriteriaName("SecReportsViewCriteriaPortal");
voReport.setNamedWhereClauseParam("FileName", reportid);
voReport.executeQuery();
Row rowReport = null;
rowReport = voReport.getAllRowsInRange()[0];
String reportPath = null;
if (rowReport != null) {
reportPath = (String) rowReport.getAttribute("ReportPath");
}
parameters2.put("ReportPath", reportPath);
//////////////////////////////
ViewObject kk = am1.findViewObject("SecUserBusinessView1");
ViewObjectImpl userrow =(ViewObjectImpl)kk;
userrow.setApplyViewCriteriaName("SecUserBusinessViewCriteria");
userrow.setNamedWhereClauseParam("pers", pers);
userrow.executeQuery();
Row[] userRows = userrow.getAllRowsInRange();
if (userRows.length > 0) {
Row row3 = userRows[0];
row3.getAttribute("UserId");
String userid = null;
userid = String.valueOf(row3.getAttribute("UserId"));
parameters2.put("userid1", userid);
}
showReportPortal(parameters2);
}
} else {
System.out.println("empty");
}
} //end while loop
// } 0,3 prol
} //end for language loop
}
CallableStatement statement = null;
BigDecimal org1= new BigDecimal(org);
//Integer org1 =Integer.valueOf(org);
//st=((DBTransaction) am.getTransaction()).createCallableStatement
statement = ((DBTransaction) am.getTransaction()).createCallableStatement
(("BEGIN "+"CREATE_NOTIFICATION_FROM_PROC(?,?,?);" +
"END;"), 0);
try {
statement.setString(1, username);
statement.setBigDecimal(2, org1);
statement.setString(3, "Η διαδικασία ολοκληρώθηκε");
statement.execute();
} catch (SQLException sqlerr) {
throw new JboException(sqlerr);
}
finally {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException closeerr) {
throw new JboException(closeerr);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (am != null ) {
Configuration.releaseRootApplicationModule(am, true);
}
if (amcomphd != null ) {
Configuration.releaseRootApplicationModule(amcomphd, true);
}
if (amcomphd2 != null ) {
Configuration.releaseRootApplicationModule(amcomphd, true);
}
if (am1 != null ) {
Configuration.releaseRootApplicationModule(am1, true);
}
}
System.out.println("Main listener ended");
}
我得到的错误 java.sql.SQLException:jdeveloopers连接已经关闭