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
count = rs.getInt("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)
{
errCode = "VMSITE1";
errString = itmDBAccessEJB.getErrorString("site_code",errCode,userId,"",conn);
return errString;
}
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
}
catch(Exception ex)
......@@ -580,7 +584,9 @@ Put a validation chq amount in filter and total of details matches in case heade
}//while
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
retTabSepStrBuff.append("</Header0>");
retTabSepStrBuff.append("</group0>");
retTabSepStrBuff.append("</DocumentRoot>");
......@@ -621,11 +627,15 @@ Put a validation chq amount in filter and total of details matches in case heade
}
}
rs1.close();
rs1 = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt1.close();
pstmt1 = null;
}
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
cnt =rcpFormRefNo.size();
System.out.println("^^^^^^^rcpFormRefNo rcpFormRefNo["+rcpFormRefNo);
......@@ -1490,7 +1500,9 @@ conn = getConnection();
}
System.out.println("Group Code ::: ["+groupCode+"]");
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
//searchKey = chequeNo + ":" + custCode; //added by rajesh k to concate chequeNo and custCode
......@@ -1900,6 +1912,10 @@ conn = getConnection();
cctrCodeAdv = rs.getString(7);
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);
if(rcpMode == null)
{
......@@ -1913,8 +1929,8 @@ conn = getConnection();
rcpMap.put("acct_code__adv",acctCodeAdv);
rcpMap.put("cctr_code__adv",cctrCodeAdv);
rcpMap.put("cust_bank_ref",custBankRef);
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
}
}
catch (SQLException ex)
......@@ -1947,13 +1963,17 @@ conn = getConnection();
stdExchRate = rs.getDouble(1);
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);
rcpMap.put("std_exrt",new Double(stdExchRate));
System.out.println("FIN_ENTITY ::: "+finEntity);
rcpMap.put("fin_entity",finEntity);
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
}
}
catch (SQLException ex)
......@@ -1987,7 +2007,9 @@ conn = getConnection();
System.out.println("CASH_CODE ::: "+bankCode);
rcpMap.put("bank_code",bankCode);
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
}
}
catch (SQLException ex)
......@@ -2023,7 +2045,9 @@ conn = getConnection();
System.out.println("BANK_CODE ::: "+bankCode);
rcpMap.put("bank_code",bankCode);
rs.close();
rs = null; //Pavan Rane 23jul19[for open cursor issue]
pstmt.close();
pstmt = null;
}
}
......@@ -2063,6 +2087,10 @@ conn = getConnection();
acctCodeCfAr = rs.getString(6);
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);
rcpMap.put("acct_code__bal",acctCodeBal);
......@@ -2078,8 +2106,8 @@ conn = getConnection();
}
rcpMap.put("acct_code__cf",acctCodeCf);
rcpMap.put("cctr_code__cf",cctrCodeCf);
rs.close();
pstmt.close();
//rs.close();
//pstmt.close();
}
}
......@@ -2483,7 +2511,8 @@ conn = getConnection();
FinCommon finCommon = new FinCommon();
ReceiptDetail receiptDetail = new ReceiptDetail();
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;
String sql = "",sql2 = "",lineNo = "",currCode = "",acctCode = "",cctrCode = "",billDisc = "",bdFluctuation = "";
double exchRateRcv = 0,discount = 0,taxAmt = 0,totAmt = 0,adjAmt = 0,badDebtAmt = 0;
......@@ -2515,8 +2544,9 @@ conn = getConnection();
System.out.println("Receivables SQL : "+sql);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"Receivables SQL : "+sql,true);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
flag = true;
......@@ -2535,6 +2565,10 @@ conn = getConnection();
badDebtAmt = rs.getDouble(12);
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);
receiptDetail.setInvoiceId(invoiceId);
......@@ -2553,8 +2587,8 @@ conn = getConnection();
receiptDetail.setBadDebtAmt(badDebtAmt);
receiptDetail.setRefSer(tranSer);
stmt.close();
stmt = null;
//stmt.close();
//stmt = null;
}
catch (SQLException ex)
{
......@@ -2575,8 +2609,9 @@ conn = getConnection();
sql = "SELECT BILL_DISC FROM RECEIVABLES WHERE TRAN_SER = '"+tranSer+"' AND REF_NO = '"+invoiceId+"'";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
billDisc = rs.getString(1);
......@@ -2586,8 +2621,10 @@ conn = getConnection();
billDisc = "N";
}
receiptDetail.setBillDisc(billDisc);
stmt.close();
stmt = null;
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
}
catch (SQLException ex)
{
......@@ -2614,12 +2651,17 @@ conn = getConnection();
+ "( EXPORT_FUNDET.REF_NO = '"+invoiceId+"') ) ";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,sql,true);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
exprtExchRate = rs.getDouble(1);
}
rs.close(); //Pavan Rane 23jul19[for open cursor issue]
rs = null;
pstmt.close();
pstmt = null;
}
catch (SQLException ex)
{
......@@ -2682,6 +2724,23 @@ conn = getConnection();
e.printStackTrace();
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;
}// end of invoiceDetail()
......@@ -2829,10 +2888,16 @@ conn = getConnection();
pstmt.setString(19,lineNo);
pstmt.setInt(20,lineNoDet);//line number column added by kailas gaikwad on 27/5/2019
pstmt.addBatch();
pstmt.clearParameters(); //Pavan Rane 23jul19[for open cursor issue]
}
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,"[billDiscAmt TO BE + UPDATE ]:::"+billDiscAmt,true);
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"[insertReceiptDtl]END:::",true);
......@@ -2851,6 +2916,17 @@ conn = getConnection();
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}finally //Pavan Rane 23jul19[for open cursor issue]
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception se){}
}
}//insertReceiptDtl()
......@@ -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, Connection conn )throws ITMException
{
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
// Connection conn = null; // commented by cpatil 14/11/13
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String tranId = "";
......@@ -2948,8 +3025,9 @@ conn = getConnection();
//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
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = '"+windowName+"'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
System.out.println("keyString :"+rs.toString());
String tranSer1 = "";
String keyString = "";
......@@ -2962,8 +3040,8 @@ conn = getConnection();
}
rs.close();
rs = null;
stmt.close();
stmt = null;
pstmt.close(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = null;
System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol);
......@@ -3002,6 +3080,16 @@ conn = getConnection();
//System.out.println("Closing Connection3...");
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 = null; // commented by cpatil 14/11/13
}
......@@ -3012,7 +3100,8 @@ conn = getConnection();
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 = "";
int cnt = 0;
try
......@@ -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()+"'";
//Commented by Manoj dtd 03/05/2014writeLog(filePtr,"UPDATE SQL FOR RECEIPT(S-INV)"+sql,true);
stmt = conn.createStatement();
cnt = stmt.executeUpdate(sql);
//stmt = conn.createStatement(); //Pavan Rane 23jul19[for open cursor issue]
pstmt = conn.prepareStatement(sql);
cnt = pstmt.executeUpdate();
System.out.println("No of records updated in RECEIPT is : "+cnt);
System.out.println("Update SQL : "+sql);
stmt.close();
stmt = null;
pstmt.close();
pstmt = null;
}
catch (SQLException ex)
{
......@@ -3047,6 +3137,18 @@ conn = getConnection();
e.printStackTrace();
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;
}//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