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
This diff is collapsed.
......@@ -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