Commit 2aa401b9 authored by vvengurlekar's avatar vvengurlekar

GlOpenConf.java - connection rollback added in catch block


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191609 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1ce08948
......@@ -44,7 +44,7 @@ public class GlOpenConf extends ActionHandlerEJB implements GlOpenConfLocal,GlO
System.out.println("Returning Result ::"+result);
return result;
}
private String confirmGlOpenConf(String tranID,String xtraParams)throws RemoteException,ITMException
private String confirmGlOpenConf(String tranID,String xtraParams)throws RemoteException,ITMException, SQLException
{
Connection conn = null;
//Statement stmt = null;
......@@ -96,14 +96,16 @@ public class GlOpenConf extends ActionHandlerEJB implements GlOpenConfLocal,GlO
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
String empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
//Commented and added by varsha v on 04-10-18 for taking loginCode as userId
//userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
//Commented and ended by varsha v on 04-10-18 for taking loginCode as userId
try
{
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
conn.setAutoCommit(false); //Gulzar 06-12-06
}
catch(Exception ex)
......@@ -143,6 +145,16 @@ conn = getConnection();
System.out.println("SQLException [04][GlOpenConf][Excuting Query Failed]" + sql + se.getMessage());
se.printStackTrace();
retString = se.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e)
{
System.out.println("Exception --["+ e.getMessage()+"]");
}
//Ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
catch(Exception e)
......@@ -150,6 +162,16 @@ conn = getConnection();
System.out.println("Exception [05][GlOpenConf][Excuting Query Failed]" + sql + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
finally
......@@ -172,6 +194,16 @@ conn = getConnection();
System.out.println("Exception [06][GlOpenConf]" + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
System.out.println("Exception In Closing Statement and ResultSet" + retString);
return retString;
}
......@@ -232,6 +264,16 @@ conn = getConnection();
System.out.println("SQLException [04][GlOpenConf][Excuting Query Failed]" + sql + se.getMessage());
se.printStackTrace();
retString = se.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e)
{
System.out.println("Exception --["+ e.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
catch(Exception e)
......@@ -239,6 +281,16 @@ conn = getConnection();
System.out.println("Exception [05][GlOpenConf][Excuting Query Failed]" + sql + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
finally
......@@ -261,6 +313,16 @@ conn = getConnection();
System.out.println("Exception [06][GlOpenConf]" + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
System.out.println("Exception In Closing Statement and ResultSet" + retString);
return retString;
}
......@@ -276,20 +338,22 @@ conn = getConnection();
"VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,? )";
System.out.println("Inserting Into ACCTBAL FOR 000000 :: "+sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,acctPrd);
//added by varsha v on 04-10-18 add checknull
pstmt.setString(1,checkNull(acctPrd));
pstmt.setString(2,"000000");
pstmt.setString(3,finEnt);
pstmt.setString(4,siteCode);
pstmt.setString(5,acctCode);
pstmt.setString(6,cctrCode);
pstmt.setString(3,checkNull(finEnt));
pstmt.setString(4,checkNull(siteCode));
pstmt.setString(5,checkNull(acctCode));
pstmt.setString(6,checkNull(cctrCode));
pstmt.setDouble(7,drAmt);
pstmt.setDouble(8,crAmt);
pstmt.setString(9,currCode);
pstmt.setString(9,checkNull(currCode));
pstmt.setDouble(10,drAmtBase);
pstmt.setDouble(11,crAmtBase);
pstmt.setTimestamp(12,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm);
pstmt.setString(13,checkNull(chgUser));
pstmt.setString(14,checkNull(chgTerm));
//ended by varsha v on 04-10-18 add checknull
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
......@@ -315,6 +379,16 @@ conn = getConnection();
System.out.println("Exception [11][GlOpenConf][Insert Query Failed]" + sqlIns + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
finally
......@@ -332,6 +406,16 @@ conn = getConnection();
System.out.println("Exception [12][GlOpenConf]" + sqlIns + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception --["+ e1.getMessage()+"]");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
}
......@@ -347,20 +431,22 @@ conn = getConnection();
System.out.println("Inserting Into ACCTBAL FOR zzzzzz :: "+sqlIns);
pstmt = conn.prepareStatement(sqlIns);
pstmt.setString(1,acctPrd);
//added by varsha v on 04-10-18 add checknull
pstmt.setString(1,checkNull(acctPrd));
pstmt.setString(2,"zzzzzz");
pstmt.setString(3,finEnt);
pstmt.setString(4,siteCode);
pstmt.setString(5,acctCode);
pstmt.setString(6,cctrCode);
pstmt.setString(3,checkNull(finEnt));
pstmt.setString(4,checkNull(siteCode));
pstmt.setString(5,checkNull(acctCode));
pstmt.setString(6,checkNull(cctrCode));
pstmt.setDouble(7,drAmt);
pstmt.setDouble(8,crAmt);
pstmt.setString(9,currCode);
pstmt.setString(9,checkNull(currCode));
pstmt.setDouble(10,drAmtBase);
pstmt.setDouble(11,crAmtBase);
pstmt.setTimestamp(12,new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm);
pstmt.setString(13,checkNull(chgUser));
pstmt.setString(14,checkNull(chgTerm));
//added by varsha v on 04-10-18 add checknull
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
......@@ -386,6 +472,16 @@ conn = getConnection();
System.out.println("Exception [11][GlOpenConf][Insert Query Failed]" + sqlIns + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
finally
......@@ -403,6 +499,16 @@ conn = getConnection();
System.out.println("Exception [12][GlOpenConf]" + sqlIns + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
}
......@@ -478,6 +584,16 @@ conn = getConnection();
System.out.println("Exception [11][GlOpenConf][Update Query Failed]" + sqlUpd + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
finally
......@@ -494,7 +610,17 @@ conn = getConnection();
{
System.out.println("Exception [12][GlOpenConf]" + sqlUpd + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
}//Finally Block
......@@ -535,6 +661,16 @@ conn = getConnection();
se.printStackTrace();
conn.rollback();
retString = se.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
catch(Exception e)
......@@ -543,6 +679,16 @@ conn = getConnection();
conn.rollback();
System.out.println("Exception[17] ::"+e.getMessage());
e.printStackTrace();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
retString = "Not Confirmed :" + e.getMessage();
}
finally
......@@ -560,6 +706,16 @@ conn = getConnection();
System.out.println("SQLException [18] Connection Error Closed :" + se.getMessage());
se.printStackTrace();
retString = "Connection Not Closed :" + se.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
}//finally
......@@ -601,6 +757,16 @@ conn = getConnection();
System.out.println("Exception [20][confirmGlOpenConf]" + e.getMessage());
e.printStackTrace();
retString = e.getMessage();
//added by varsha v on 04-10-18 to rollback connnection if exceptiion caught
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("Exception In Rollback Transaction");
}
//ended by varsha v on 04-10-18 to rollback connnection if exceptiion caught
return retString;
}
}// Finally Block
......@@ -608,7 +774,7 @@ conn = getConnection();
System.out.println("retString ::"+retString);
return retString;
}
private boolean dupConf(String tarnID,Connection conn) throws ITMException
private boolean dupConf(String tarnID,Connection conn) throws ITMException, SQLException
{
//Statement stmt = null;
PreparedStatement pstmt = null;
......@@ -644,6 +810,35 @@ conn = getConnection();
e.printStackTrace();
throw new ITMException(e);
}
//added by varsha v on 04-10-18 finally block added
finally
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
//added by varsha v on 04-10-18 finally block added
return flag;
}
// added checkNull method by varsha v on 4-10-18
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
else
{
input = input.trim();
}
return input;
}
//ended checkNull method by varsha v on 4-10-18
}
\ No newline at end of file
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