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 ...@@ -47,10 +47,10 @@ public class GlOpenConf extends ActionHandlerEJB implements GlOpenConfLocal,GlO
private String confirmGlOpenConf(String tranID,String xtraParams)throws RemoteException,ITMException private String confirmGlOpenConf(String tranID,String xtraParams)throws RemoteException,ITMException
{ {
Connection conn = null; Connection conn = null;
Statement stmt = null; //Statement stmt = null;
Statement lstmt = null; //Statement lstmt = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null, pstmt2 = null;
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null, pstmt3 = null;
ResultSet rsHdr = null; ResultSet rsHdr = null;
ResultSet rsDtl = null; ResultSet rsDtl = null;
ResultSet rsMast = null; ResultSet rsMast = null;
...@@ -118,8 +118,10 @@ conn = getConnection(); ...@@ -118,8 +118,10 @@ conn = getConnection();
try 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()+"'"; 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(); //stmt = conn.createStatement();
rsHdr = stmt.executeQuery(sql); //rsHdr = stmt.executeQuery(sql);
pstmt2 = conn.prepareStatement(sql);
rsHdr = pstmt2.executeQuery();
if (rsHdr.next()) if (rsHdr.next())
{ {
siteCode = rsHdr.getString("SITE_CODE"); siteCode = rsHdr.getString("SITE_CODE");
...@@ -131,6 +133,10 @@ conn = getConnection(); ...@@ -131,6 +133,10 @@ conn = getConnection();
chgUser = rsHdr.getString("CHG_USER"); chgUser = rsHdr.getString("CHG_USER");
chgTerm = rsHdr.getString("CHG_TERM"); chgTerm = rsHdr.getString("CHG_TERM");
} }
rsHdr.close();
rsHdr = null;
pstmt2.close();
pstmt2 = null;
} }
catch(SQLException se) catch(SQLException se)
{ {
...@@ -150,10 +156,16 @@ conn = getConnection(); ...@@ -150,10 +156,16 @@ conn = getConnection();
{ {
try try
{ {
stmt.close(); if(pstmt2 != null)
stmt = null; {
rsHdr.close(); pstmt2.close();
rsHdr = null; pstmt2 = null;
}
if(rsHdr != null)
{
rsHdr.close();
rsHdr = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -176,8 +188,10 @@ conn = getConnection(); ...@@ -176,8 +188,10 @@ conn = getConnection();
try 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+"'"; 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(); //lstmt = conn.createStatement();
rsDtl = lstmt.executeQuery(sqlDtl); //rsDtl = lstmt.executeQuery(sqlDtl);
pstmt2 = conn.prepareStatement(sqlDtl);
rsDtl = pstmt2.executeQuery();
while (rsDtl.next()) while (rsDtl.next())
{ {
acctCode = rsDtl.getString("ACCT_CODE"); acctCode = rsDtl.getString("ACCT_CODE");
...@@ -199,13 +213,18 @@ conn = getConnection(); ...@@ -199,13 +213,18 @@ conn = getConnection();
"WHERE ACCT_PRD = '"+acctPrd+"' AND PRD_CODE = '000000' AND FIN_ENTITY = '"+finEnt+"' AND SITE_CODE = '"+siteCode+"' "+ "WHERE ACCT_PRD = '"+acctPrd+"' AND PRD_CODE = '000000' AND FIN_ENTITY = '"+finEnt+"' AND SITE_CODE = '"+siteCode+"' "+
"AND ACCT_CODE = '"+acctCode+"' AND CCTR_CODE = '"+cctrCode+"' "; "AND ACCT_CODE = '"+acctCode+"' AND CCTR_CODE = '"+cctrCode+"' ";
stmt = conn.createStatement(); //stmt = conn.createStatement();
rsMast = stmt.executeQuery(sql); //rsMast = stmt.executeQuery(sql);
pstmt3 = conn.prepareStatement(sql);
rsMast = pstmt3.executeQuery();
if (rsMast.next()) if (rsMast.next())
{ {
cnt = rsMast.getInt("COUNT"); cnt = rsMast.getInt("COUNT");
} }
pstmt3.close();
pstmt3 = null;
rsMast.close();
rsMast = null;
System.out.println( "COUNT::::::"+cnt); System.out.println( "COUNT::::::"+cnt);
} }
catch(SQLException se) catch(SQLException se)
...@@ -226,10 +245,16 @@ conn = getConnection(); ...@@ -226,10 +245,16 @@ conn = getConnection();
{ {
try try
{ {
stmt.close(); if(pstmt3 != null)
stmt = null; {
rsMast.close(); pstmt3.close();
rsMast = null; pstmt3 = null;
}
if(rsMast != null)
{
rsMast.close();
rsMast = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -266,6 +291,8 @@ conn = getConnection(); ...@@ -266,6 +291,8 @@ conn = getConnection();
pstmt.setString(13,chgUser); pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm); pstmt.setString(14,chgTerm);
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Query Executed ::INSERT A RECORD FOR 000000 IN MASTER"); System.out.println("Query Executed ::INSERT A RECORD FOR 000000 IN MASTER");
} }
catch(SQLException se) catch(SQLException se)
...@@ -294,8 +321,11 @@ conn = getConnection(); ...@@ -294,8 +321,11 @@ conn = getConnection();
{ {
try try
{ {
pstmt.close(); if(pstmt != null)
pstmt = null; {
pstmt.close();
pstmt = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -332,6 +362,8 @@ conn = getConnection(); ...@@ -332,6 +362,8 @@ conn = getConnection();
pstmt.setString(13,chgUser); pstmt.setString(13,chgUser);
pstmt.setString(14,chgTerm); pstmt.setString(14,chgTerm);
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Query Executed ::INSERT A RECORD FOR ZZZZZZ IN MASTER"); System.out.println("Query Executed ::INSERT A RECORD FOR ZZZZZZ IN MASTER");
} }
catch(SQLException se) catch(SQLException se)
...@@ -360,8 +392,11 @@ conn = getConnection(); ...@@ -360,8 +392,11 @@ conn = getConnection();
{ {
try try
{ {
pstmt.close(); if(pstmt != null)
pstmt = null; {
pstmt.close();
pstmt = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -415,6 +450,8 @@ conn = getConnection(); ...@@ -415,6 +450,8 @@ conn = getConnection();
pstmt.setString(6,userId.trim()); pstmt.setString(6,userId.trim());
pstmt.setString(7,userId.trim()); pstmt.setString(7,userId.trim());
int u = pstmt.executeUpdate(); int u = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if (u < 1) if (u < 1)
{ {
System.out.println("Update Into ACCTBAL Failed : " + sqlUpd ); System.out.println("Update Into ACCTBAL Failed : " + sqlUpd );
...@@ -447,8 +484,11 @@ conn = getConnection(); ...@@ -447,8 +484,11 @@ conn = getConnection();
{ {
try try
{ {
pstmt.close(); if(pstmt!= null)
pstmt = null; {
pstmt.close();
pstmt = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -461,6 +501,10 @@ conn = getConnection(); ...@@ -461,6 +501,10 @@ conn = getConnection();
}//Else Block }//Else Block
}//While Loop }//While Loop
// UPDATE THE GL_HDR CONFIRMED FIELD // UPDATE THE GL_HDR CONFIRMED FIELD
rsDtl.close();
rsDtl = null;
pstmt2.close();
pstmt2 = null;
try try
{ {
System.out.println("emp code:="+empCode); System.out.println("emp code:="+empCode);
...@@ -482,6 +526,8 @@ conn = getConnection(); ...@@ -482,6 +526,8 @@ conn = getConnection();
{ {
System.out.println("GL_HDR Not Updated...(Not Confirmed)"); System.out.println("GL_HDR Not Updated...(Not Confirmed)");
} }
pstmt.close();
pstmt = null;
} }
catch(SQLException se) //Gulzar catch(SQLException se) //Gulzar
{ {
...@@ -539,10 +585,10 @@ conn = getConnection(); ...@@ -539,10 +585,10 @@ conn = getConnection();
rsDtl.close(); rsDtl.close();
rsDtl = null; rsDtl = null;
} }
if (lstmt != null) if (pstmt2 != null)
{ {
lstmt.close(); pstmt2.close();
lstmt = null; pstmt2 = null;
} }
if (conn != null) if (conn != null)
{ {
...@@ -564,7 +610,8 @@ conn = getConnection(); ...@@ -564,7 +610,8 @@ conn = getConnection();
} }
private boolean dupConf(String tarnID,Connection conn) throws ITMException private boolean dupConf(String tarnID,Connection conn) throws ITMException
{ {
Statement stmt = null; //Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql=""; String sql="";
boolean flag = false; boolean flag = false;
...@@ -575,8 +622,10 @@ conn = getConnection(); ...@@ -575,8 +622,10 @@ conn = getConnection();
System.out.println("[ConfirmGl_openEJB:] [dupConf] EXECUTE SELECT: "+sql); System.out.println("[ConfirmGl_openEJB:] [dupConf] EXECUTE SELECT: "+sql);
stmt = conn.createStatement(); //stmt = conn.createStatement();
rs = stmt.executeQuery(sql); pstmt = conn.prepareStatement(sql);
//rs = stmt.executeQuery(sql);
rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
if(rs.getInt(1)!= 0) if(rs.getInt(1)!= 0)
...@@ -585,7 +634,9 @@ conn = getConnection(); ...@@ -585,7 +634,9 @@ conn = getConnection();
} }
} }
rs.close(); rs.close();
stmt.close(); rs = null;
pstmt.close();
pstmt = null;
} }
catch(SQLException e) catch(SQLException e)
{ {
......
...@@ -356,11 +356,17 @@ conn = getConnection(); ...@@ -356,11 +356,17 @@ conn = getConnection();
{ {
try try
{ {
pstmt.close(); if(pstmt != null)
pstmt = null; {
pstmt.close();
pstmt = null;
}
//stmt3.close(); //stmt3.close();
pstmt3.close(); if(pstmt3 != null)
pstmt3 = null; {
pstmt3.close();
pstmt3 = null;
}
} }
catch(Exception e) catch(Exception e)
...@@ -448,8 +454,11 @@ conn = getConnection(); ...@@ -448,8 +454,11 @@ conn = getConnection();
{ {
try try
{ {
pstmt.close(); if(pstmt != null)
pstmt = null; {
pstmt.close();
pstmt = null;
}
} }
catch(Exception e) 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