Commit 46c07429 authored by manohar's avatar manohar

AD01MAC001 connection auto commit made false and proper commit rollback added...

AD01MAC001 connection auto commit made false and proper commit rollback added also resultset and statements closed properly


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91359 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0fa41980
......@@ -63,6 +63,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
stmt = conn.createStatement();
System.out.println("TranId ::"+tranId);
sql = "SELECT CONFIRMED,HOLD FROM PAYR_VOUCHER WHERE TRAN_ID = '"+tranId+"'";
......@@ -75,6 +77,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
hold = rs.getString(2);
System.out.println("hold ::"+hold);
}
rs.close();
rs = null;
if (confirm.equals("Y"))
{
sql = "SELECT TOT_AMT, ADJ_AMT, HOLD_AMT FROM MISC_PAYABLES "
......@@ -90,6 +94,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
holdAmt = rs.getDouble(3);
System.out.println("holdAmt ::"+holdAmt);
}
rs.close();
rs = null;
if ((totalAmt - adjAmt) == 0)
{
errCode = "VTBAL2"; // already paid off
......@@ -107,6 +113,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
pstmt.setString(1,"P-VOUC");
pstmt.setString(2,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
updSql ="UPDATE PAYR_VOUCHER SET HOLD = 'Y' WHERE TRAN_ID = ? ";
......@@ -114,6 +122,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
pstmt = conn.prepareStatement(updSql);
pstmt.setString(1,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
if (updateCnt > 0)
{
......@@ -130,6 +140,8 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
pstmt = conn.prepareStatement(updSql);
pstmt.setString(1,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
if (updateCnt > 0)
{
......@@ -137,6 +149,14 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
}
}//end hold if
}//end confirm else
if ("VTHOLD2".equals(errCode))
{
conn.commit();
}
else
{
conn.rollback();
}
if (errCode != null && errCode.trim().length() > 0)
{
System.out.println("PayrVoucherHldEJB:errCode:"+errCode);
......@@ -158,8 +178,21 @@ public class PayrVoucherHld extends ActionHandlerEJB implements PayrVoucherHldLo
try
{
System.out.println("Closing Connection.....");
conn.close();
conn = null;
if (stmt != null)
{
stmt.close();
stmt = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}catch(Exception e){}
}
return errString;
......
......@@ -63,6 +63,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
stmt = conn.createStatement();
System.out.println("TranId ::"+tranId);
sql = "SELECT CONFIRMED,HOLD FROM PAYR_VOUCHER WHERE TRAN_ID = '"+tranId+"'";
......@@ -75,6 +77,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
hold = rs.getString(2);
System.out.println("hold ::"+hold);
}
rs.close();
rs = null;
if (hold.equals(""))
{
errCode = "VTHLDNLL";
......@@ -94,6 +98,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
holdAmt = rs.getDouble(3);
System.out.println("holdAmt ::"+holdAmt);
}
rs.close();
rs = null;
if ((totalAmt - adjAmt) == 0)
{
errCode = "VTBAL2"; // already paid off
......@@ -110,6 +116,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
pstmt.setString(1,"P-VOUC");
pstmt.setString(2,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
updSql ="UPDATE PAYR_VOUCHER SET HOLD = 'N' WHERE TRAN_ID = ? ";
......@@ -117,6 +125,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
pstmt = conn.prepareStatement(updSql);
pstmt.setString(1,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
if (updateCnt > 0)
{
......@@ -133,6 +143,8 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
pstmt = conn.prepareStatement(updSql);
pstmt.setString(1,tranId);
updateCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("updateCnt ::"+updateCnt);
if (updateCnt > 0)
{
......@@ -140,6 +152,14 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
}
}//end hold if
}//end confirm else
if ("VTHOLD1".equals(errCode))
{
conn.commit();
}
else
{
conn.rollback();
}
if (errCode != null && errCode.trim().length() > 0)
{
System.out.println("PayrVoucherRlsEJB:errCode:"+errCode);
......@@ -161,8 +181,21 @@ public class PayrVoucherRls extends ActionHandlerEJB implements PayrVoucherRlsLo
try
{
System.out.println("Closing Connection.....");
conn.close();
conn = null;
if (stmt != null)
{
stmt.close();
stmt = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}catch(Exception e){}
}
return errString;
......
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