关闭代码中数据库连接

This commit is contained in:
zhangjun 2018-11-02 17:40:00 +08:00
parent 42a4bbaa0a
commit 8140fb6346
6 changed files with 27 additions and 7 deletions

View File

@ -36,6 +36,7 @@ public class CashFlowExecutor {
this.add(cb, tcb);
String irr = this.getIrr(cb,tcb);
cb.setIrr(irr);
tx.commit();
return irr;
}
private String getIrr(ConditionBean cb ,TabCalBean tcb) throws Exception{
@ -178,6 +179,7 @@ public class CashFlowExecutor {
Sqlca = Transaction.createTransaction(tx);
SqlObject asql = new SqlObject(sql);
Sqlca.executeSQL(asql);
Sqlca.commit();
}

View File

@ -287,6 +287,12 @@ public class ColRelativeInfo {
Transaction tran = Transaction.createTransaction(tx);
String result = tran.getString(new SqlObject("select count(1) from user_task_data where userid = '" + UserID + "' and roleid = '" + RoleID + "' and status = 'approve_status01' group by userid,roleid"));
tx.commit();
if(tran != null){
tran.disConnect();
tran = null;
}
return result == null ? "" : result;
}

View File

@ -7,6 +7,8 @@ import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.springframework.jdbc.object.SqlCall;
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP;
import jbo.prd.BUSINESS_TYPE;
@ -377,13 +379,19 @@ public class ProductBaseLoanTools {
"coldefaultvalue", getNowTotal(productId));
String productType = "";
Transaction Sqlca = null;
try {
Transaction Sqlca = Transaction
Sqlca = Transaction
.createTransaction((String) RestfullConstant.baseProperty
.get("DATASOURCE".toLowerCase()));
productType = Sqlca.getString(new SqlObject("select attribute2 from business_type where typeno='"+productId+"'"));
} catch (SQLException e) {
ARE.getLog().error(e);;
ARE.getLog().error(e);
}finally{
if(Sqlca != null){
Sqlca.disConnect();
Sqlca=null;
}
}
//非车辆产品融资额可编辑

View File

@ -318,7 +318,7 @@ public class DoSubmitService {
String sUserId = request.getSession().getAttribute("userid").toString();
JBOTransaction tx1 = JBOFactory.createJBOTransaction();
//JBOTransaction tx1 = JBOFactory.createJBOTransaction();
/*
* com.amarsoft.biz.workflow.FlowTask ft = new
* com.amarsoft.biz.workflow.FlowTask( taskNo, tx);// ʹÓÃjboTrans String

View File

@ -28,7 +28,10 @@ public class AmarScriptHelper {
sqlca =Transaction.createTransaction(manager.getDatabase());
}
Any a= Expression.getExpressionValue(script, sqlca);
if(sqlca!=null) sqlca.disConnect();
if(sqlca!=null){
sqlca.commit();
sqlca.disConnect();
}
return a;
} catch (Exception e) {
throw new Exception("脚本错误:" + script);

View File

@ -190,9 +190,9 @@ public class DataOperatorUtil {
}else{
otherPropertyValue+="'"+otherProperty.get(key)+"'";
}}
Transaction Sqlca =null;
Sqlca = Transaction.createTransaction(tx);
Connection conn =tx.getConnection(Sqlca);
//Transaction Sqlca =null;
//Sqlca = Transaction.createTransaction(tx);
//Connection conn =tx.getConnection(Sqlca);
String sql="SELECT DISTINCT B.COLUMN_NAME TALBECOLUMN FROM Information_schema.columns B WHERE LOWER(B.table_name)=LOWER('"+fromTable+"') AND EXISTS(SELECT * FROM Information_schema.columns A WHERE LOWER(A.table_name)=LOWER('"+toTable+"') AND B.column_name=A.column_name )";
if("ORACLE".equals(InitDBType.DBTYPE)){
sql="select B.COLUMN_NAME TALBECOLUMN from user_tab_columns B WHERE B.table_name='"+fromTable+"' AND EXISTS(SELECT 1 FROM user_tab_columns A WHERE A.table_name='"+toTable+"' AND B.column_name=A.column_name )";
@ -500,6 +500,7 @@ public class DataOperatorUtil {
while (rs.next()) {
data.add( FileOperatorUtil.getASResultSetToMap(rs));
}
Sqlca.commit();
return data;
}
}