Commit 5d4712a2 authored by dpawar's avatar dpawar

Manage Connection


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96123 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1e1817de
......@@ -29,9 +29,26 @@ import java.util.*;
public class MiscValConf extends ActionHandlerEJB implements MiscValConfLocal,MiscValConfRemote //SessionBean
{
public String confirm(String tranId,String xtraParams,String forcedFlag) throws RemoteException,ITMException
{
public String confirm(String tranId,String xtraParams,String forcedFlag) throws RemoteException,ITMException{
String errString ="";
Connection conn = null;
try{
errString = confirm(tranId, xtraParams, forcedFlag, conn);
}catch (Exception e) {
// TODO: handle exception
System.out.println("Exception in confirm() ==>"+e.getMessage());
errString = GenericUtility.getInstance().createErrorString(e);
System.out.println("errString in cofirm() ==>"+errString);
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
public String confirm(String tranId,String xtraParams,String forcedFlag,Connection conn) throws RemoteException,ITMException
{
//Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
......@@ -43,15 +60,22 @@ public class MiscValConf extends ActionHandlerEJB implements MiscValConfLocal,Mi
FinCommon finCommon = null;
GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null;
boolean isLocalConn = false;
if(conn==null){
isLocalConn = true;
}
try
{
finCommon = new FinCommon();
genericUtility = new GenericUtility();
itmDBAccessEJB = new ITMDBAccessEJB();
if(isLocalConn){
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
}
sql =" select confirmed,site_code from MISC_VOUCHER where tran_id = ?";
pstmt = conn.prepareStatement(sql);
......@@ -97,10 +121,12 @@ public class MiscValConf extends ActionHandlerEJB implements MiscValConfLocal,Mi
{
if(errString.indexOf("CONFSUCCES") > -1)
{
if(isLocalConn)
conn.commit();
}
else
{
if(isLocalConn)
conn.rollback();
}
}
......@@ -114,6 +140,7 @@ public class MiscValConf extends ActionHandlerEJB implements MiscValConfLocal,Mi
pstmt.close();
pstmt = null;
}
if(isLocalConn)
conn.close();
}
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