Commit 1c2eec14 authored by prane's avatar prane

Changes done related to open cursor issue(Maximum open cursor exceed)

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203891 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 69c62ad7
...@@ -321,14 +321,18 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -321,14 +321,18 @@ Put a validation chq amount in filter and total of details matches in case heade
count = rs.getInt("COUNT"); count = rs.getInt("COUNT");
System.out.println("SITE_CODE count is ::- "+count ); System.out.println("SITE_CODE count is ::- "+count );
} }
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
if(count == 0) if(count == 0)
{ {
errCode = "VMSITE1"; errCode = "VMSITE1";
errString = itmDBAccessEJB.getErrorString("site_code",errCode,userId,"",conn); errString = itmDBAccessEJB.getErrorString("site_code",errCode,userId,"",conn);
return errString; return errString;
} }
rs.close(); //rs.close();
pstmt.close(); //pstmt.close();
} }
catch(Exception ex) catch(Exception ex)
...@@ -580,7 +584,9 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -580,7 +584,9 @@ Put a validation chq amount in filter and total of details matches in case heade
}//while }//while
rs.close(); rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close(); pstmt.close();
pstmt = null;
retTabSepStrBuff.append("</Header0>"); retTabSepStrBuff.append("</Header0>");
retTabSepStrBuff.append("</group0>"); retTabSepStrBuff.append("</group0>");
retTabSepStrBuff.append("</DocumentRoot>"); retTabSepStrBuff.append("</DocumentRoot>");
...@@ -621,11 +627,15 @@ Put a validation chq amount in filter and total of details matches in case heade ...@@ -621,11 +627,15 @@ Put a validation chq amount in filter and total of details matches in case heade
} }
} }
rs1.close(); rs1.close();
rs1 = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt1.close(); pstmt1.close();
pstmt1 = null;
} }
rs.close(); rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close(); pstmt.close();
pstmt = null;
cnt =rcpFormRefNo.size(); cnt =rcpFormRefNo.size();
System.out.println("^^^^^^^rcpFormRefNo rcpFormRefNo["+rcpFormRefNo); System.out.println("^^^^^^^rcpFormRefNo rcpFormRefNo["+rcpFormRefNo);
...@@ -1490,7 +1500,9 @@ conn = getConnection(); ...@@ -1490,7 +1500,9 @@ conn = getConnection();
} }
System.out.println("Group Code ::: ["+groupCode+"]"); System.out.println("Group Code ::: ["+groupCode+"]");
rs.close(); rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close(); pstmt.close();
pstmt = null;
//searchKey = chequeNo + ":" + custCode; //added by rajesh k to concate chequeNo and custCode //searchKey = chequeNo + ":" + custCode; //added by rajesh k to concate chequeNo and custCode
...@@ -1900,6 +1912,10 @@ conn = getConnection(); ...@@ -1900,6 +1912,10 @@ conn = getConnection();
cctrCodeAdv = rs.getString(7); cctrCodeAdv = rs.getString(7);
custBankRef = rs.getString(8); custBankRef = rs.getString(8);
} }
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
System.out.println("curr_code ::: "+currCode); System.out.println("curr_code ::: "+currCode);
if(rcpMode == null) if(rcpMode == null)
{ {
...@@ -1913,8 +1929,8 @@ conn = getConnection(); ...@@ -1913,8 +1929,8 @@ conn = getConnection();
rcpMap.put("acct_code__adv",acctCodeAdv); rcpMap.put("acct_code__adv",acctCodeAdv);
rcpMap.put("cctr_code__adv",cctrCodeAdv); rcpMap.put("cctr_code__adv",cctrCodeAdv);
rcpMap.put("cust_bank_ref",custBankRef); rcpMap.put("cust_bank_ref",custBankRef);
rs.close(); //rs.close();
pstmt.close(); //pstmt.close();
} }
} }
catch (SQLException ex) catch (SQLException ex)
...@@ -1947,13 +1963,17 @@ conn = getConnection(); ...@@ -1947,13 +1963,17 @@ conn = getConnection();
stdExchRate = rs.getDouble(1); stdExchRate = rs.getDouble(1);
finEntity = rs.getString(2); finEntity = rs.getString(2);
} }
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
System.out.println("STD_EXRT ::: "+stdExchRate); System.out.println("STD_EXRT ::: "+stdExchRate);
rcpMap.put("std_exrt",new Double(stdExchRate)); rcpMap.put("std_exrt",new Double(stdExchRate));
System.out.println("FIN_ENTITY ::: "+finEntity); System.out.println("FIN_ENTITY ::: "+finEntity);
rcpMap.put("fin_entity",finEntity); rcpMap.put("fin_entity",finEntity);
rs.close(); //rs.close();
pstmt.close(); //pstmt.close();
} }
} }
catch (SQLException ex) catch (SQLException ex)
...@@ -1987,7 +2007,9 @@ conn = getConnection(); ...@@ -1987,7 +2007,9 @@ conn = getConnection();
System.out.println("CASH_CODE ::: "+bankCode); System.out.println("CASH_CODE ::: "+bankCode);
rcpMap.put("bank_code",bankCode); rcpMap.put("bank_code",bankCode);
rs.close(); rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close(); pstmt.close();
pstmt = null;
} }
} }
catch (SQLException ex) catch (SQLException ex)
...@@ -2023,7 +2045,9 @@ conn = getConnection(); ...@@ -2023,7 +2045,9 @@ conn = getConnection();
System.out.println("BANK_CODE ::: "+bankCode); System.out.println("BANK_CODE ::: "+bankCode);
rcpMap.put("bank_code",bankCode); rcpMap.put("bank_code",bankCode);
rs.close(); rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close(); pstmt.close();
pstmt = null;
} }
} }
...@@ -2063,6 +2087,10 @@ conn = getConnection(); ...@@ -2063,6 +2087,10 @@ conn = getConnection();
acctCodeCfAr = rs.getString(6); acctCodeCfAr = rs.getString(6);
cctrCodeCfAr = rs.getString(7); cctrCodeCfAr = rs.getString(7);
} }
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
System.out.println("ACCT_CODE__BAL ::: "+acctCodeBal); System.out.println("ACCT_CODE__BAL ::: "+acctCodeBal);
rcpMap.put("acct_code__bal",acctCodeBal); rcpMap.put("acct_code__bal",acctCodeBal);
...@@ -2078,8 +2106,8 @@ conn = getConnection(); ...@@ -2078,8 +2106,8 @@ conn = getConnection();
} }
rcpMap.put("acct_code__cf",acctCodeCf); rcpMap.put("acct_code__cf",acctCodeCf);
rcpMap.put("cctr_code__cf",cctrCodeCf); rcpMap.put("cctr_code__cf",cctrCodeCf);
rs.close(); //rs.close();
pstmt.close(); //pstmt.close();
} }
} }
...@@ -2483,7 +2511,8 @@ conn = getConnection(); ...@@ -2483,7 +2511,8 @@ conn = getConnection();
FinCommon finCommon = new FinCommon(); FinCommon finCommon = new FinCommon();
ReceiptDetail receiptDetail = new ReceiptDetail(); ReceiptDetail receiptDetail = new ReceiptDetail();
java.sql.Timestamp refDate = null,dueDate = null; java.sql.Timestamp refDate = null,dueDate = null;
Statement stmt = null,stmt2 = null; //Statement stmt = null,stmt2 = null;
PreparedStatement pstmt = null;
ResultSet rs = null,rs2 = null; ResultSet rs = null,rs2 = null;
String sql = "",sql2 = "",lineNo = "",currCode = "",acctCode = "",cctrCode = "",billDisc = "",bdFluctuation = ""; String sql = "",sql2 = "",lineNo = "",currCode = "",acctCode = "",cctrCode = "",billDisc = "",bdFluctuation = "";
double exchRateRcv = 0,discount = 0,taxAmt = 0,totAmt = 0,adjAmt = 0,badDebtAmt = 0; double exchRateRcv = 0,discount = 0,taxAmt = 0,totAmt = 0,adjAmt = 0,badDebtAmt = 0;
...@@ -2515,8 +2544,9 @@ conn = getConnection(); ...@@ -2515,8 +2544,9 @@ conn = getConnection();
System.out.println("Receivables SQL : "+sql); System.out.println("Receivables SQL : "+sql);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"Receivables SQL : "+sql,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"Receivables SQL : "+sql,true);
stmt = conn.createStatement(); //stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
rs = stmt.executeQuery(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
flag = true; flag = true;
...@@ -2535,6 +2565,10 @@ conn = getConnection(); ...@@ -2535,6 +2565,10 @@ conn = getConnection();
badDebtAmt = rs.getDouble(12); badDebtAmt = rs.getDouble(12);
lineNo = rs.getString(13); lineNo = rs.getString(13);
} }
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
System.out.println("REF_DATE :: "+refDate); System.out.println("REF_DATE :: "+refDate);
receiptDetail.setInvoiceId(invoiceId); receiptDetail.setInvoiceId(invoiceId);
...@@ -2553,8 +2587,8 @@ conn = getConnection(); ...@@ -2553,8 +2587,8 @@ conn = getConnection();
receiptDetail.setBadDebtAmt(badDebtAmt); receiptDetail.setBadDebtAmt(badDebtAmt);
receiptDetail.setRefSer(tranSer); receiptDetail.setRefSer(tranSer);
stmt.close(); //stmt.close();
stmt = null; //stmt = null;
} }
catch (SQLException ex) catch (SQLException ex)
{ {
...@@ -2575,8 +2609,9 @@ conn = getConnection(); ...@@ -2575,8 +2609,9 @@ conn = getConnection();
sql = "SELECT BILL_DISC FROM RECEIVABLES WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+invoiceId+"'"; sql = "SELECT BILL_DISC FROM RECEIVABLES WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+invoiceId+"'";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true);
stmt = conn.createStatement(); //stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
rs = stmt.executeQuery(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
billDisc = rs.getString(1); billDisc = rs.getString(1);
...@@ -2586,8 +2621,10 @@ conn = getConnection(); ...@@ -2586,8 +2621,10 @@ conn = getConnection();
billDisc = "N"; billDisc = "N";
} }
receiptDetail.setBillDisc(billDisc); receiptDetail.setBillDisc(billDisc);
stmt.close(); rs.close(); //Pavan Rane 23jul19[for open cursor issue]
stmt = null; rs = null;
pstmt.close();
pstmt = null;
} }
catch (SQLException ex) catch (SQLException ex)
{ {
...@@ -2614,12 +2651,17 @@ conn = getConnection(); ...@@ -2614,12 +2651,17 @@ conn = getConnection();
+ "( EXPORT_FUNDET.REF_NO = '"+invoiceId+"') ) "; + "( EXPORT_FUNDET.REF_NO = '"+invoiceId+"') ) ";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true);
stmt = conn.createStatement(); //stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
rs = stmt.executeQuery(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
exprtExchRate = rs.getDouble(1); exprtExchRate = rs.getDouble(1);
} }
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
} }
catch (SQLException ex) catch (SQLException ex)
{ {
...@@ -2682,6 +2724,23 @@ conn = getConnection(); ...@@ -2682,6 +2724,23 @@ conn = getConnection();
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally //Pavan Rane 23jul19[for open cursor issue]
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception se){}
}
return receiptDetail; return receiptDetail;
}// end of invoiceDetail() }// end of invoiceDetail()
...@@ -2829,10 +2888,16 @@ conn = getConnection(); ...@@ -2829,10 +2888,16 @@ conn = getConnection();
pstmt.setString(19,lineNo); pstmt.setString(19,lineNo);
pstmt.setInt(20,lineNoDet);//line number column added by kailas gaikwad on 27/5/2019 pstmt.setInt(20,lineNoDet);//line number column added by kailas gaikwad on 27/5/2019
pstmt.addBatch(); pstmt.addBatch();
pstmt.clearParameters(); //Pavan Rane 23jul19[for open cursor issue]
} }
pstmt.executeBatch(); pstmt.executeBatch();
//Pavan Rane 23jul19[for open cursor issue]
pstmt.clearBatch();
pstmt.close();
pstmt = null;
//Pavan Rane 23jul19 end
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[billAmt TO BE + UPDATE ]:::"+billAmt,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[billAmt TO BE + UPDATE ]:::"+billAmt,true);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[billDiscAmt TO BE + UPDATE ]:::"+billDiscAmt,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[billDiscAmt TO BE + UPDATE ]:::"+billDiscAmt,true);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[insertReceiptDtl]END:::",true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[insertReceiptDtl]END:::",true);
...@@ -2851,6 +2916,17 @@ conn = getConnection(); ...@@ -2851,6 +2916,17 @@ conn = getConnection();
System.out.println("Exception ::" + e.getMessage() + ":"); System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
}finally //Pavan Rane 23jul19[for open cursor issue]
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception se){}
} }
}//insertReceiptDtl() }//insertReceiptDtl()
...@@ -2934,9 +3010,10 @@ conn = getConnection(); ...@@ -2934,9 +3010,10 @@ conn = getConnection();
//private String generateTranTd(String windowName,String tranDate,String siteCode )throws ITMException //private String generateTranTd(String windowName,String tranDate,String siteCode )throws ITMException
private String generateTranTd(String windowName,String tranDate,String siteCode, Connection conn )throws ITMException private String generateTranTd(String windowName,String tranDate,String siteCode, Connection conn )throws ITMException
{ {
ConnDriver connDriver = new ConnDriver(); //ConnDriver connDriver = new ConnDriver();
// Connection conn = null; // commented by cpatil 14/11/13 // Connection conn = null; // commented by cpatil 14/11/13
Statement stmt = null; //Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
String tranId = ""; String tranId = "";
...@@ -2948,8 +3025,9 @@ conn = getConnection(); ...@@ -2948,8 +3025,9 @@ conn = getConnection();
//conn = getConnection();//commented by Nandkumar gadkari on 29/03/18 //conn = getConnection();//commented by Nandkumar gadkari on 29/03/18
//Changes and Commented By Bhushan on 06-06-2016 :END // commented by cpatil 14/11/13 //Changes and Commented By Bhushan on 06-06-2016 :END // commented by cpatil 14/11/13
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = '"+windowName+"'"; sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = '"+windowName+"'";
stmt = conn.createStatement(); //stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
rs = stmt.executeQuery(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
System.out.println("keyString :"+rs.toString()); System.out.println("keyString :"+rs.toString());
String tranSer1 = ""; String tranSer1 = "";
String keyString = ""; String keyString = "";
...@@ -2962,8 +3040,8 @@ conn = getConnection(); ...@@ -2962,8 +3040,8 @@ conn = getConnection();
} }
rs.close(); rs.close();
rs = null; rs = null;
stmt.close(); pstmt.close(); //Pavan Rane 23jul19[for open cursor issue]
stmt = null; pstmt = null;
System.out.println("keyString :"+keyString); System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol); System.out.println("keyCol :"+keyCol);
...@@ -3002,6 +3080,16 @@ conn = getConnection(); ...@@ -3002,6 +3080,16 @@ conn = getConnection();
//System.out.println("Closing Connection3..."); //System.out.println("Closing Connection3...");
try try
{ {
if(rs != null) //Pavan Rane 23jul19[for open cursor issue]
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// conn.close(); // commented by cpatil 14/11/13 // conn.close(); // commented by cpatil 14/11/13
// conn = null; // commented by cpatil 14/11/13 // conn = null; // commented by cpatil 14/11/13
} }
...@@ -3012,7 +3100,8 @@ conn = getConnection(); ...@@ -3012,7 +3100,8 @@ conn = getConnection();
private int updateReceipt(double netAmt,double billAmt,double billDiscAmt,String tranId,Connection conn)throws ITMException private int updateReceipt(double netAmt,double billAmt,double billDiscAmt,String tranId,Connection conn)throws ITMException
{ {
Statement stmt = null; //Statement stmt = null;
PreparedStatement pstmt = null;
String sql = ""; String sql = "";
int cnt = 0; int cnt = 0;
try try
...@@ -3025,13 +3114,14 @@ conn = getConnection(); ...@@ -3025,13 +3114,14 @@ conn = getConnection();
+ "BILL_DISC_AMT = (CASE WHEN BILL_DISC_AMT IS NULL THEN 0 ELSE BILL_DISC_AMT END + ("+billDiscAmt+")) WHERE TRAN_ID = '"+tranId.trim()+"'"; + "BILL_DISC_AMT = (CASE WHEN BILL_DISC_AMT IS NULL THEN 0 ELSE BILL_DISC_AMT END + ("+billDiscAmt+")) WHERE TRAN_ID = '"+tranId.trim()+"'";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"UPDATE SQL FOR RECEIPT(S-INV)"+sql,true); //Commented by Manoj dtd 03/05/2014writeLog(filePtr,"UPDATE SQL FOR RECEIPT(S-INV)"+sql,true);
stmt = conn.createStatement(); //stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
cnt = stmt.executeUpdate(sql); pstmt = conn.prepareStatement(sql);
cnt = pstmt.executeUpdate();
System.out.println("No of records updated in RECEIPT is : "+cnt); System.out.println("No of records updated in RECEIPT is : "+cnt);
System.out.println("Update SQL : "+sql); System.out.println("Update SQL : "+sql);
stmt.close(); pstmt.close();
stmt = null; pstmt = null;
} }
catch (SQLException ex) catch (SQLException ex)
{ {
...@@ -3047,6 +3137,18 @@ conn = getConnection(); ...@@ -3047,6 +3137,18 @@ conn = getConnection();
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally //Pavan Rane 23jul19[for open cursor issue]
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception se){}
}
return cnt; return cnt;
}//updateReceipt() }//updateReceipt()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment