Commit b360014f authored by vvengurlekar's avatar vvengurlekar

ReceivablesOpeningConf.java - added Resultset and prepared statement closing...

ReceivablesOpeningConf.java - added Resultset and prepared statement closing after checking null sequencially


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@192790 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6f42c501
...@@ -178,10 +178,22 @@ conn = getConnection(); ...@@ -178,10 +178,22 @@ conn = getConnection();
acctPrd = rs.getString("ACCT_PRD"); //Gulzar 30/11/6 acctPrd = rs.getString("ACCT_PRD"); //Gulzar 30/11/6
refType = rs.getString("TRAN_TYPE"); //Gulzar 02-12-06 refType = rs.getString("TRAN_TYPE"); //Gulzar 02-12-06
} }
pstmt.close(); //Added by varsha v on 12-11-18 for changing sequence of closing statements
/*pstmt.close();
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Ended by varsha v on 12-11-18 for changing sequence of closing statements
} }
catch(SQLException se) catch(SQLException se)
{ {
...@@ -335,10 +347,22 @@ conn = getConnection(); ...@@ -335,10 +347,22 @@ conn = getConnection();
{ {
cnt = rsMst.getInt("COUNT"); cnt = rsMst.getInt("COUNT");
} }
pstmt1.close(); //Added by varsha v on 12-11-18 for changing sequence of closing statements
/*pstmt1.close();
pstmt1 = null; pstmt1 = null;
rsMst.close(); rsMst.close();
rsMst = null; rsMst = null;*/
if(rsMst != null)
{
rsMst.close();
rsMst = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
//ended by varsha v on 12-11-18 for changing sequence of closing statements
} }
catch(SQLException se) catch(SQLException se)
{ {
...@@ -441,10 +465,22 @@ conn = getConnection(); ...@@ -441,10 +465,22 @@ conn = getConnection();
totAmtOld = rsMst.getDouble("TOT_AMT"); totAmtOld = rsMst.getDouble("TOT_AMT");
} }
//rs.close(); //rs.close();
pstmt1.close(); //Added by varsha v on 12-11-18 for changing sequence of closing statements
/*pstmt1.close();
pstmt1 = null; pstmt1 = null;
rsMst.close(); rsMst.close();
rsMst = null; rsMst = null;*/
if(rsMst != null)
{
rsMst.close();
rsMst = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
//Ended by varsha v on 12-11-18 for changing sequence of closing statements
diffAmt = totAmt - totAmtOld; diffAmt = totAmt - totAmtOld;
System.out.println("diffAmt = totAmt - totAmtOld : " + diffAmt); System.out.println("diffAmt = totAmt - totAmtOld : " + diffAmt);
if (totAmtOld < 0) if (totAmtOld < 0)
...@@ -489,10 +525,22 @@ conn = getConnection(); ...@@ -489,10 +525,22 @@ conn = getConnection();
{ {
keyString = rsMst.getString("KEY_STRING"); keyString = rsMst.getString("KEY_STRING");
} }
rsMst.close(); //Added by varsha v on 12-11-18 for changing sequence of closing statements
/*rsMst.close();
rsMst = null; rsMst = null;
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;*/
if(rsMst != null)
{
rsMst.close();
rsMst = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
//Ended by varsha v on 12-11-18 for changing sequence of closing statements
String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+ String XMLString = "<?xml version=\"1.0\"?>\r\n<Root>\r\n<header>"+
"\r\n</header><Detail1><item_ser>"+itemSer+"</item_ser>"+ "\r\n</header><Detail1><item_ser>"+itemSer+"</item_ser>"+
"\r\n<site_code>"+siteCode+"</site_code>\r\n<tran_date>"+tranDate+"</tran_date></Detail1></Root>"; "\r\n<site_code>"+siteCode+"</site_code>\r\n<tran_date>"+tranDate+"</tran_date></Detail1></Root>";
...@@ -569,6 +617,13 @@ conn = getConnection(); ...@@ -569,6 +617,13 @@ conn = getConnection();
System.out.println("SQLException [10][confirmReceivables][Excuting Query Failed]" + sqlIns + se.getMessage()); System.out.println("SQLException [10][confirmReceivables][Excuting Query Failed]" + sqlIns + se.getMessage());
try try
{ {
//added by Varsha V on 12-11-18 for closing connection
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//added by Varsha V on 12-11-18 for closing connection
conn.rollback(); conn.rollback();
} }
catch(Exception e) catch(Exception e)
...@@ -619,6 +674,18 @@ conn = getConnection(); ...@@ -619,6 +674,18 @@ conn = getConnection();
{ {
try try
{ {
//added by Varsha V on 12-11-18 for closing connection
if(rsMst != null)
{
rsMst.close();
rsMst = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
//Ended by Varsha V on 12-11-18 for closing connection
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
...@@ -706,7 +773,7 @@ conn = getConnection(); ...@@ -706,7 +773,7 @@ conn = getConnection();
System.out.println("SQLException [13][confirmReceivables][Excuting Query Fail]" + sql+ se.getMessage()); System.out.println("SQLException [13][confirmReceivables][Excuting Query Fail]" + sql+ se.getMessage());
try try
{ {
//added by Varsha V on 11-10-18 for closing connection //added by Varsha V on 11-10-18 for closing connection
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
...@@ -862,10 +929,22 @@ conn = getConnection(); ...@@ -862,10 +929,22 @@ conn = getConnection();
//conn.commit(); //Jiten 27/07/06 - not required //conn.commit(); //Jiten 27/07/06 - not required
} }
rsDtl.close(); /*rsDtl.close();
rsDtl = null; rsDtl = null;
pstmt3.close(); pstmt3.close();
pstmt3 = null; pstmt3 = null;*/
//added by Varsha V on 12-11-18 for closing connection after checking null
if(rsDtl != null)
{
rsDtl.close();
rsDtl = null;
}
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
//Ended by Varsha V on 12-11-18 for closing connection after checking null
try try
{ {
String sqlUpdateHdr = "UPDATE RECEIVABLES_HDR SET CONFIRMED = 'Y', CONF_DATE = ? ,EMP_CODE__APRV = ? WHERE TRAN_ID = ?"; String sqlUpdateHdr = "UPDATE RECEIVABLES_HDR SET CONFIRMED = 'Y', CONF_DATE = ? ,EMP_CODE__APRV = ? WHERE TRAN_ID = ?";
...@@ -894,7 +973,6 @@ conn = getConnection(); ...@@ -894,7 +973,6 @@ conn = getConnection();
{ {
System.out.println("SQLException[16] :[ReceivablesOpeningConfEJB][Excuting Query Failed]" + sql + se.getMessage()); System.out.println("SQLException[16] :[ReceivablesOpeningConfEJB][Excuting Query Failed]" + sql + se.getMessage());
se.printStackTrace(); se.printStackTrace();
conn.rollback();//Added by Jiten 27/07/06
//added by Varsha V on 11-10-18 for closing connection //added by Varsha V on 11-10-18 for closing connection
if(pstmt != null) if(pstmt != null)
{ {
...@@ -902,6 +980,7 @@ conn = getConnection(); ...@@ -902,6 +980,7 @@ conn = getConnection();
pstmt = null; pstmt = null;
} }
//ended by Varsha V on 11-10-18 for closing connection //ended by Varsha V on 11-10-18 for closing connection
conn.rollback();//Added by Jiten 27/07/06
retString = se.getMessage(); retString = se.getMessage();
//added throws clause by Varsha V //added throws clause by Varsha V
throw new ITMException(se); throw new ITMException(se);
...@@ -910,13 +989,13 @@ conn = getConnection(); ...@@ -910,13 +989,13 @@ conn = getConnection();
catch(Exception e) catch(Exception e)
{ {
retString = "Not Confirmed"; retString = "Not Confirmed";
conn.rollback();//Added by Jiten 27/07/06
//added by Varsha V on 11-10-18 for closing connection //added by Varsha V on 11-10-18 for closing connection
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
conn.rollback();//Added by Jiten 27/07/06
//ended by Varsha V on 11-10-18 for closing connection //ended by Varsha V on 11-10-18 for closing connection
System.out.println("Exception[17] ::"+e.getMessage()); System.out.println("Exception[17] ::"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
...@@ -970,16 +1049,24 @@ conn = getConnection(); ...@@ -970,16 +1049,24 @@ conn = getConnection();
{ {
try try
{ {
if (pstmt != null) //added by Varsha V on 12-11-18 for closing connection after checking null
{
pstmt.close();
pstmt = null;
}
if (rsDtl != null) if (rsDtl != null)
{ {
rsDtl.close(); rsDtl.close();
rsDtl = null; rsDtl = null;
} }
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
//Ended by Varsha V on 12-11-18 for closing connection after checking null
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)//Added by Jiten 27/07/06 if (conn != null)//Added by Jiten 27/07/06
{ {
conn.close(); conn.close();
...@@ -1012,6 +1099,23 @@ conn = getConnection(); ...@@ -1012,6 +1099,23 @@ conn = getConnection();
{ {
try try
{ {
//added by Varsha V on 12-11-18 forchanging sequence closing connection
if (rsDtl != null)
{
rsDtl.close();
rsDtl = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (rsMst != null)
{
rsMst.close();
rsMst = null;
}
//Ended by Varsha V on 12-11-18 forchanging sequence closing connection
if (pstmt1 != null) if (pstmt1 != null)
{ {
pstmt1.close(); pstmt1.close();
...@@ -1037,21 +1141,7 @@ conn = getConnection(); ...@@ -1037,21 +1141,7 @@ conn = getConnection();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}*/ }*/
if (rsDtl != null)
{
rsDtl.close();
rsDtl = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (rsMst != null)
{
rsMst.close();
rsMst = null;
}
if (conn != null)//Added by Jiten 27/07/06 if (conn != null)//Added by Jiten 27/07/06
{ {
conn.close(); conn.close();
......
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