最新消息:本站持续更新中,请注意添加收藏夹。搜索关键词时,多换一个同义词。比如要搜索界面,可以尝试页面,画面,PER档等词汇。善于搜索,将大大提高你的查找效率。

Ecology OA多数据源开发

实施与配置 bron1984 4094浏览

多数据源开发

  1. 创建数据源,点击创建数据源,添加数据源参数,保存,然后测试,看是否成功。

  1. 连接数据源的方法,代码如下
weaver.interfaces.datasource.DataSource ds = (weaver.interfaces.datasource.DataSource) StaticObj.getServiceByFullname((“datasource.GSRM”), weaver.interfaces.datasource.DataSource.class);

java.sql.Connection conn = ds.getConnection();

  1. 代码操作,采购jdbc方式连接,直接操作本地数据库
public String test(String requestId,String lastname){

weaver.interfaces.datasource.DataSource ds = (weaver.interfaces.datasource.DataSource) StaticObj.getServiceByFullname((“datasource.GSRM”), weaver.interfaces.datasource.DataSource.class);

java.sql.Connection conn = ds.getConnection();

PreparedStatement ps=null;

//创建结果集

if (null == conn)

{

writeLog(“连接为空。”);

} else {

writeLog(“已经连接。”);

}

 

//为采购申请主表修改状态

try {

String sql0 =”update gsrm_porequest_entry set STATUS_POREQUEST=’2′ where request_id='”+requestId+”‘”;

ps = conn.prepareStatement(sql0);

int count = ps.executeUpdate();

writeLog(“============修改条数1:” + String.valueOf(count));

} catch (SQLException e) {

e.printStackTrace();

}

//采购申请从表修改状态

try {

String sql =”update gsrm_porequest set BPM_STATUS=’3′ where request_id='”+requestId+”‘”;

ps = conn.prepareStatement(sql);

int count = ps.executeUpdate();

writeLog(“============修改条数2:” + String.valueOf(count));

} catch (Exception e) {

e.printStackTrace();

}

 

//

try {

String sql1 =”update GSRM_POREQUEST_ENTRY set POREQ_ENTRY_BUYER='”+lastname+”‘ where id in( select id from GSRM_POREQUEST_ENTRY where POREQ_ENTRY_FINTERID in(select POREQ_FINTERID from gsrm_porequest where request_id='”+requestId+”‘ ))”;

ps = conn.prepareStatement(sql1);

int count = ps.executeUpdate();

writeLog(“============修改条数3:” + String.valueOf(count));

} catch (Exception e) {

e.printStackTrace();

}

try {

ps.close();

conn.close();

} catch (SQLException e) {

e.printStackTrace();

}

return “1”;

}

转载请注明:赫非域 » Ecology OA多数据源开发