Commit 8205ccbd authored by msingh's avatar msingh

Changed by Manish on 26/04/16 for closing the statement and result set


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101354 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4f7c6515
......@@ -38,7 +38,7 @@ import org.w3c.dom.NodeList;
@Stateless
public class AutoPmtGenPrc extends ProcessEJB
implements AutoPmtGenPrcLocal, AutoPmtGenPrcRemote
implements AutoPmtGenPrcLocal, AutoPmtGenPrcRemote
{
File filePtr;
File logDir;
......@@ -46,7 +46,7 @@ public class AutoPmtGenPrc extends ProcessEJB
static String logOnOffFlag = "";
ValidatorEJB validatorEJB = new ValidatorEJB();
String err = "";
// GenericUtility genericUtility = GenericUtility.getInstance();
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
......@@ -716,7 +716,7 @@ public class AutoPmtGenPrc extends ProcessEJB
HashMap splitCodeWiseNegMap = new HashMap();
HashMap tempMapNeg = null;
ArrayList tempListNeg = null;
Timestamp refDateSTr=null;
Timestamp refDateSTr=null;
java.util.Date dueDatediff = null;
double pay_amt = 0.0D; double totamount = 0.0D; double totAmtRem = 0.0D;
String sundryCodeNeg = "";
......@@ -1733,7 +1733,7 @@ Timestamp refDateSTr=null;
{
dueMaxDate = currentDate1;
}
//added by priyanka on 06/01/16
//added by priyanka on 06/01/16
String dueMaxStr = sdf.format(dueMaxDate);
System.out.println("Due Date Max======"+dueMaxStr);
refDateSTr = Timestamp.valueOf(genericUtility.getValidDateString(dueMaxStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
......@@ -2208,7 +2208,9 @@ Timestamp refDateSTr=null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Statement stmt = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null;
ResultSet rs = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
......@@ -2227,10 +2229,12 @@ Timestamp refDateSTr=null;
String soundPlay = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
String sqlQuery = "SELECT MSG_TYPE,MSG_STR,MSG_DESCR,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE FROM MESSAGES WHERE MSG_NO='" + msgNo + "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlQuery);
//stmt = conn.createStatement();
pstmt = conn.prepareStatement(sqlQuery);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
......@@ -2249,19 +2253,23 @@ Timestamp refDateSTr=null;
msgString = "";
}
//Changed by wasim on 17-03-2016 to close statement/Result set [START]
if(stmt!=null)
if(pstmt!=null)
{
stmt.close();stmt=null;
pstmt.close();
pstmt=null;
}
if(rs!=null)
{
rs.close();rs=null;
rs.close();
rs=null;
}
//Changed by wasim on 17-03-2016 to close statement/Result set [END]
if ((msgType.equals("E")) || (msgType.trim().length() == 0))
{
String sqlQuery1 = "SELECT PROFILE_ID FROM USERS WHERE CODE='" + userId + "'";
rs1 = conn.createStatement().executeQuery(sqlQuery1);
// rs1 = conn.createStatement().executeQuery(sqlQuery1);
pstmt1 = conn.prepareStatement(sqlQuery1);
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
profileId = rs1.getString("profile_id");
......@@ -2270,12 +2278,37 @@ Timestamp refDateSTr=null;
profileId = "";
}
sqlQuery1 = "SELECT MSG_TYPE FROM MESSAGES_LEVEL WHERE MSG_NO='" + msgNo.trim() + "' AND PROFILE_ID='" + profileId.trim() + "'";
rs2 = conn.createStatement().executeQuery(sqlQuery1);
//rs2 = conn.createStatement().executeQuery(sqlQuery1);
pstmt2 = conn.prepareStatement(sqlQuery1);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
tempMsgType = rs2.getString("msg_type");
}
}
//Changed by Manish on 25-04-2016 to close statement/Result set [START]
if(pstmt1 != null)
{
pstmt1.close();
pstmt1=null;
}
if(rs1!=null)
{
rs1.close();
rs1=null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2=null;
}
if(rs2!=null)
{
rs2.close();
rs2=null;
}
//Changed by Manish on 25-04-2016 to close statement/Result set [END]
if ((tempMsgType != null) && (tempMsgType.trim().length() > 0))
{
msgType = tempMsgType;
......@@ -2322,6 +2355,7 @@ Timestamp refDateSTr=null;
rs1.close();
}
conn.close();
}
catch (ITMException itme)
{
......@@ -2376,21 +2410,35 @@ Timestamp refDateSTr=null;
{
try
{
if(stmt!=null)
if(pstmt!=null)
{
stmt.close();stmt = null;
pstmt.close();
pstmt = null;
}
if(rs!=null)
{
rs.close();rs=null;
rs.close();
rs=null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1=null;
}
if(rs1!=null)
{
rs1.close();rs1=null;
rs1.close();
rs1=null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2=null;
}
if(rs2!=null)
{
rs2.close();rs2=null;
rs2.close();
rs2=null;
}
}
catch(Exception ex)
......
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