Commit e926c306 authored by vvengurlekar's avatar vvengurlekar

TrainexecCnf.java - connection related chnages done in file


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@201680 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c012fd65
......@@ -9,15 +9,20 @@
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.*;
import javax.ejb.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import ibase.webitm.utility.GenericUtility;
//import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
@Stateless // added for ejb3
public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,TrainexecCnfRemote //SessionBean
......@@ -44,7 +49,6 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
}
public String confirm(String trainNo, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
try
{
......@@ -72,20 +76,24 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
//Changed by Varsha V on 06-06-19 for GenericUtility purpose[START]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Changed by Varsha V on 06-06-19 for GenericUtility purpose[END]
int cnt = 0;
try
{
batchNo = trainNo.substring(trainNo.indexOf(":")+1);
trainNo = trainNo.substring(0,trainNo.indexOf(":"));
System.out.println("Batch No :"+ batchNo);
System.out.println("Train No :"+ trainNo);
conn = connDriver.getConnectDB("DriverITM");
//Changed by Varsha V on 06-06-19 for connection purpose[START]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changed by Varsha V on 06-06-19 for connection purpose[END]
conn.setAutoCommit(false);
//INTO :LS_CONFIRMED, :LS_TRAIN_CODE, :LD_START
sql = "SELECT CONFIRM, TRAIN_CODE , START_DATE " +
......@@ -102,7 +110,16 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
trainCode = rs.getString(2);
startDate = rs.getDate(3);
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (confirmed.trim().equalsIgnoreCase("N"))
{
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
......@@ -131,13 +148,29 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
{
startPrd = rs.getString(1);
}
//Changed by Varsha V on 06-06-19 for connection purpose[START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changed by Varsha V on 06-06-19 for connection purpose[END]
sql = "SELECT COMM_CATG, EMP_CODE " +
"FROM TRAINEMP " +
"WHERE TRAIN_NO = '" + trainNo + "'" +
"AND BATCH_NO = '" + batchNo + "'" ;
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if(stmt != null)
{
stmt.close();
stmt = null;
}
sql = "UPDATE TRAINNEED " +
"SET STATUS = 'U'," +
"STATUS_DATE = ?," +
......@@ -161,6 +194,18 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
pstmt.setString(7, startPrd);
cnt += pstmt.executeUpdate();
}
//Changed by Varsha V on 06-06-19 for connection purpose[START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changed by Varsha V on 06-06-19 for connection purpose[END]
if (cnt > 0)
{
errCode = "VTMCONF2";
......@@ -197,6 +242,18 @@ public class TrainexecCnf extends ActionHandlerEJB implements TrainexecCnfLocal,
{
if (conn!=null)
{
//Changed by Varsha V on 06-06-19 for connection purpose[START]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changed by Varsha V on 06-06-19 for connection purpose[END]
conn.close();
conn = null;
}
......
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