Commit 61724154 authored by prane's avatar prane

Open Cursor Issue

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190892 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 04405040
......@@ -67,7 +67,7 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
String errString = "";
String errCode = "";
Connection conn = null;
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
......@@ -87,7 +87,7 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
try
{
conn = getConnection();
stmt = conn.createStatement();
//stmt = conn.createStatement();
userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
// GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -138,7 +138,9 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
}
System.out.println("curr_code:::"+currCode);
sql = "SELECT COUNT(*) AS COUNT FROM CURRENCY WHERE curr_code = '"+currCode+"'";
rs = stmt.executeQuery(sql);
pstmt = conn.prepareStatement(sql);
//rs = stmt.executeQuery(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("COUNT");
......@@ -149,6 +151,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
break;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}//END FOR
......@@ -294,7 +300,8 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
int currentFormNo = 0;
String errCode = "";
Connection connGl = null;
Statement stmtGl = null;
//Statement stmtGl = null;
PreparedStatement pstmt = null;
ResultSet rsGl = null;
String errString = "";
StringBuffer valueXmlString = new StringBuffer();
......@@ -368,7 +375,7 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
{
String keyStringQuery = null;
String tranId = null;
PreparedStatement pstmt = null;
//PreparedStatement pstmt = null;
ResultSet rSet = null ;
Statement stmt = null;
String accPrd = "";
......@@ -379,19 +386,27 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
String currCode = "";
System.out.println("Login site "+loginSite);
sql = "SELECT acct_prd FROM parameter";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
accPrd = rsGl.getString(1);
}
rsGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
sql = "SELECT A.DESCR,A.FIN_ENTITY, B.DESCR, B.CURR_CODE, C.DESCR "
+" FROM SITE A, FINENT B, CURRENCY C "
+ "WHERE A.FIN_ENTITY = B.FIN_ENTITY "
+ "AND B.CURR_CODE = C.CURR_CODE "
+ "AND A.SITE_CODE ='" +loginSite+ "'";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
while (rsGl.next())
{
siteDescr = rsGl.getString(1);
......@@ -400,7 +415,11 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
currCode = rsGl.getString(4);
currDescr = rsGl.getString(5);
}
stmtGl.close();
//stmtGl.close();
rsGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
System.out.println("SiteCode::::"+loginSite);
System.out.println("sitSiteCode Desc::::"+siteDescr);
System.out.println("FinEntity.:::"+finEnt);
......@@ -430,14 +449,19 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
try
{
sql = "SELECT DESCR FROM CURRENCY WHERE CURR_CODE ='" +columnValue+ "'";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
currDescr = rsGl.getString(1);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -465,8 +489,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
+ "WHERE A.FIN_ENTITY = B.FIN_ENTITY "
+ "AND B.CURR_CODE = C.CURR_CODE "
+ "AND A.SITE_CODE ='" +columnValue+ "'";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
while (rsGl.next())
{
siteDescr = rsGl.getString(1);
......@@ -475,7 +501,11 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
currCode = rsGl.getString(4);
currDescr = rsGl.getString(5);
}
stmtGl.close();
//stmtGl.close();
rsGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
System.out.println("SiteCode::::"+columnValue);
System.out.println("sitSiteCode Desc::::"+siteDescr);
System.out.println("FinEntity.:::"+finEnt);
......@@ -548,14 +578,19 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
sqlEx = "SELECT CURR_CODE FROM FINENT WHERE FIN_ENTITY ='" +finEnt+ "'";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sqlEx);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sqlEx);
pstmt = connGl.prepareStatement(sqlEx);
rsGl = pstmt.executeQuery();
while (rsGl.next())
{
dbCurrCode = rsGl.getString(1);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
System.out.println("Curr Code from DATA BASE:::"+dbCurrCode);
System.out.println("Curr Code from HEADER:::"+dbCurrCode);
......@@ -605,15 +640,19 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
{
sql = "SELECT DESCR FROM ACCOUNTS WHERE ACCT_CODE ='" +columnValue+ "'";
cctrCode = getColumnValue("cctr_code",dom);
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
acctDescr = rsGl.getString(1);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -635,8 +674,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
" and SITE_CODE = '"+ siteCode +"' AND ACCT_CODE = '"+ columnValue +"' AND CCTR_CODE = '"+ cctrCode +"'";
try
{
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
crAmtOld = rsGl.getDouble(1);
......@@ -645,7 +686,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
drAmtBaseOld = rsGl.getDouble(4);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -673,14 +717,19 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
try
{
sql = "SELECT DESCR FROM COSTCTR WHERE cctr_code ='" +columnValue+ "'";
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
cctrDescr = rsGl.getString(1);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -701,8 +750,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
" and SITE_CODE = '"+ siteCode +"' AND ACCT_CODE = '"+acctCode +"' AND CCTR_CODE = '"+ columnValue +"'";
try
{
stmtGl = connGl.createStatement();
rsGl = stmtGl.executeQuery(sql);
//stmtGl = connGl.createStatement();
//rsGl = stmtGl.executeQuery(sql);
pstmt = connGl.prepareStatement(sql);
rsGl = pstmt.executeQuery();
if (rsGl.next())
{
crAmtOld = rsGl.getInt(1);
......@@ -711,7 +762,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
drAmtBaseOld = rsGl.getInt(4);
}
rsGl.close();
stmtGl.close();
//stmtGl.close();
rsGl = null;
pstmt.close();
pstmt = null;
}
catch(Exception e)
{
......@@ -747,19 +801,23 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
String errCode = "", siteSpec = "";
long counter;
String sql1 = "";
Statement statement1 = null;
//Statement statement1 = null;
PreparedStatement pstmt1 = null;
ResultSet resultSet1 = null;
String sql2 = "";
Statement stmt2 = null;
//Statement stmt2 = null;
PreparedStatement pstmt2 = null;
ResultSet resultSet2 = null;
String sql3 = "";
Statement stmt3 = null;
//Statement stmt3 = null;
PreparedStatement pstmt3 = null;
ResultSet rs3 = null;
StringBuffer sql4 = null;
Statement stmt4 = null;
//Statement stmt4 = null;
PreparedStatement pstmt4 = null;
ResultSet rs4 = null;
boolean connectionState = false;
try
......@@ -770,20 +828,26 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
connectionState = true;
}
sql1 = "SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'SITE_SPECIFIC_ACCT'";
statement1 = con.createStatement();
resultSet1 = statement1.executeQuery(sql1);
//statement1 = con.createStatement();
//resultSet1 = statement1.executeQuery(sql1);
pstmt1 = con.prepareStatement(sql1);
resultSet1 = pstmt1.executeQuery();
if (resultSet1.next())
{
sql2 = "SELECT COUNT(*) FROM ACCOUNTS WHERE ACCT_CODE = '" + acctCode + "'";
stmt2 = con.createStatement();
resultSet2 = stmt2.executeQuery(sql2);
//stmt2 = con.createStatement();
//resultSet2 = stmt2.executeQuery(sql2);
pstmt2 = con.prepareStatement(sql2);
resultSet2 = pstmt2.executeQuery();
if (resultSet2.next())
{
if (resultSet2.getLong(1) != 0)
{
sql3 = "SELECT ACTIVE FROM ACCOUNTS WHERE ACCT_CODE = '" + acctCode + "'";
stmt3 = con.createStatement();
rs3 = stmt3.executeQuery(sql3);
//stmt3 = con.createStatement();
//rs3 = stmt3.executeQuery(sql3);
pstmt3 = con.prepareStatement(sql3);
rs3 = pstmt3.executeQuery();
if (rs3.next())
{
if (!rs3.getString(1).equals("Y"))
......@@ -800,8 +864,10 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
sql4.append("SELECT COUNT(*) FROM SITE_ACCOUNT WHERE SITE_CODE = '");
sql4.append(siteCode).append("' AND ACCT_CODE = '");
sql4.append(acctCode).append("'");
stmt4 = con.createStatement();
rs4 = stmt4.executeQuery(sql4.toString());
//stmt4 = con.createStatement();
//rs4 = stmt4.executeQuery(sql4.toString());
pstmt4 = con.prepareStatement(sql4.toString());
rs4 = pstmt4.executeQuery();
if (rs4.next())
{
if (rs4.getLong(1) == 0)
......@@ -809,21 +875,36 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
errCode = "VMACCT4";
}
}
rs4.close();
rs4 = null;
pstmt4.close();
pstmt4 = null;
}
}
}
rs3.close();
rs3 = null;
pstmt3.close();
pstmt3 = null;
}
else
{
errCode = "VMACCT1";
}
}
resultSet2.close();
resultSet2 = null;
pstmt2.close();
pstmt2 = null;
}
if (resultSet1 != null) //Rakesh
{
resultSet1.close();
}
if (resultSet2 != null)
pstmt1.close();
pstmt1 = null;
/*if (resultSet2 != null)
{
resultSet2.close();
}
......@@ -855,7 +936,7 @@ public class GlOpen extends ValidatorEJB implements GlOpenLocal,GlOpenRemote //
{
stmt4.close();
stmt4 = null;
}
}*/
//Added by sarita on 15NOV2017 for open cursor issue[end]
if(connectionState == true)
{
......
......@@ -47,10 +47,10 @@ public class GlOpenConf extends ActionHandlerEJB implements GlOpenConfLocal,GlO
private String confirmGlOpenConf(String tranID,String xtraParams)throws RemoteException,ITMException
{
Connection conn = null;
Statement stmt = null;
Statement lstmt = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
//Statement stmt = null;
//Statement lstmt = null;
PreparedStatement pstmt = null, pstmt2 = null;
PreparedStatement pstmt1 = null, pstmt3 = null;
ResultSet rsHdr = null;
ResultSet rsDtl = null;
ResultSet rsMast = null;
......@@ -118,8 +118,10 @@ conn = getConnection();
try
{
sql = "SELECT SITE_CODE, FIN_ENTITY, CURR_CODE, ACCT_PRD, PRD_CODE, CHG_DATE, CHG_USER, CHG_TERM FROM GL_HDR WHERE TRAN_ID ='"+tranID.trim()+"'";
stmt = conn.createStatement();
rsHdr = stmt.executeQuery(sql);
//stmt = conn.createStatement();
//rsHdr = stmt.executeQuery(sql);
pstmt2 = conn.prepareStatement(sql);
rsHdr = pstmt2.executeQuery();
if (rsHdr.next())
{
siteCode = rsHdr.getString("SITE_CODE");
......@@ -131,6 +133,10 @@ conn = getConnection();
chgUser = rsHdr.getString("CHG_USER");
chgTerm = rsHdr.getString("CHG_TERM");
}
rsHdr.close();
rsHdr = null;
pstmt2.close();
pstmt2 = null;
}
catch(SQLException se)
{
......@@ -150,11 +156,17 @@ conn = getConnection();
{
try
{
stmt.close();
stmt = null;
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
if(rsHdr != null)
{
rsHdr.close();
rsHdr = null;
}
}
catch(Exception e)
{
System.out.println("Exception [06][GlOpenConf]" + e.getMessage());
......@@ -176,8 +188,10 @@ conn = getConnection();
try
{
sqlDtl = "SELECT ACCT_CODE,CCTR_CODE ,EXCH_RATE ,CR_AMT ,DR_AMT ,CR_AMT__BASE,DR_AMT__BASE,CR_AMT__OLD,DR_AMT__OLD,CR_AMT__BASE__OLD,DR_AMT__BASE__OLD from gl_dtl WHERE TRAN_ID ='"+tranID+"'";
lstmt = conn.createStatement();
rsDtl = lstmt.executeQuery(sqlDtl);
//lstmt = conn.createStatement();
//rsDtl = lstmt.executeQuery(sqlDtl);
pstmt2 = conn.prepareStatement(sqlDtl);
rsDtl = pstmt2.executeQuery();
while (rsDtl.next())
{
acctCode = rsDtl.getString("ACCT_CODE");
......@@ -199,13 +213,18 @@ conn = getConnection();
"WHERE ACCT_PRD = '"+acctPrd+"' AND PRD_CODE = '000000' AND FIN_ENTITY = '"+finEnt+"' AND SITE_CODE = '"+siteCode+"' "+
"AND ACCT_CODE = '"+acctCode+"' AND CCTR_CODE = '"+cctrCode+"' ";
stmt = conn.createStatement();
rsMast = stmt.executeQuery(sql);
//stmt = conn.createStatement();
//rsMast = stmt.executeQuery(sql);
pstmt3 = conn.prepareStatement(sql);
rsMast = pstmt3.executeQuery();
if (rsMast.next())
{
cnt = rsMast.getInt("COUNT");
}
pstmt3.close();
pstmt3 = null;
rsMast.close();
rsMast = null;
System.out.println( "COUNT::::::"+cnt);
}
catch(SQLException se)
......@@ -226,11 +245,17 @@ conn = getConnection();
{
try
{
stmt.close();
stmt = null;
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
if(rsMast != null)
{
rsMast.close();
rsMast = null;
}
}
catch(Exception e)
{
System.out.println("Exception [06][GlOpenConf]" + e.getMessage());
......@@ -266,6 +291,8 @@ conn = getConnection();
pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm);
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Query Executed ::INSERT A RECORD FOR 000000 IN MASTER");
}
catch(SQLException se)
......@@ -293,10 +320,13 @@ conn = getConnection();
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception [12][GlOpenConf]" + sqlIns + e.getMessage());
......@@ -332,6 +362,8 @@ conn = getConnection();
pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm);
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Query Executed ::INSERT A RECORD FOR ZZZZZZ IN MASTER");
}
catch(SQLException se)
......@@ -359,10 +391,13 @@ conn = getConnection();
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception [12][GlOpenConf]" + sqlIns + e.getMessage());
......@@ -415,6 +450,8 @@ conn = getConnection();
pstmt.setString(6,userId.trim());
pstmt.setString(7,userId.trim());
int u = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if (u < 1)
{
System.out.println("Update Into ACCTBAL Failed : " + sqlUpd );
......@@ -446,10 +483,13 @@ conn = getConnection();
finally
{
try
{
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception [12][GlOpenConf]" + sqlUpd + e.getMessage());
......@@ -461,6 +501,10 @@ conn = getConnection();
}//Else Block
}//While Loop
// UPDATE THE GL_HDR CONFIRMED FIELD
rsDtl.close();
rsDtl = null;
pstmt2.close();
pstmt2 = null;
try
{
System.out.println("emp code:="+empCode);
......@@ -482,6 +526,8 @@ conn = getConnection();
{
System.out.println("GL_HDR Not Updated...(Not Confirmed)");
}
pstmt.close();
pstmt = null;
}
catch(SQLException se) //Gulzar
{
......@@ -539,10 +585,10 @@ conn = getConnection();
rsDtl.close();
rsDtl = null;
}
if (lstmt != null)
if (pstmt2 != null)
{
lstmt.close();
lstmt = null;
pstmt2.close();
pstmt2 = null;
}
if (conn != null)
{
......@@ -564,7 +610,8 @@ conn = getConnection();
}
private boolean dupConf(String tarnID,Connection conn) throws ITMException
{
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql="";
boolean flag = false;
......@@ -575,8 +622,10 @@ conn = getConnection();
System.out.println("[ConfirmGl_openEJB:] [dupConf] EXECUTE SELECT: "+sql);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sql);
//rs = stmt.executeQuery(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
if(rs.getInt(1)!= 0)
......@@ -585,7 +634,9 @@ conn = getConnection();
}
}
rs.close();
stmt.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(SQLException e)
{
......
......@@ -355,12 +355,18 @@ conn = getConnection();
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//stmt3.close();
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
}
catch(Exception e)
......@@ -447,9 +453,12 @@ conn = getConnection();
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
......
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