【BO-SDK】Update Database information for .rpt &nbsp&nbsp&nbsp&nbsp(BOE SDK Java Applications @_1)...

简单修改BOE上数据库连接参数,替代CMC的手动修改,此处不涉及LOV动态列表,非RAS-SDK操作。

【for Java】

[@more@]

import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.plugin.desktop.common.IReportLogon;
import com.crystaldecisions.sdk.plugin.desktop.report.IReport;

public class Update_Database_Info {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

String username = "Administrator";
String password = "****7";
String cmsName = "pvg*******:6400";
String authType = "secEnterprise";
String reportName = "Sales Dashboard";

IInfoObjects oInfoObjects=null;
IInfoObject oInfoObject=null;

IEnterpriseSession boEnterpriseSession;
try {
boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsName, authType);
IInfoStore boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");

oInfoObjects = (IInfoObjects) boInfoStore.query("Select * from CI_INFOOBJECTS Where SI_INSTANCE=0 And SI_NAME='" + reportName + "'");//确切为ID
//oInfoObjects = (IInfoObjects) boInfoStore.query("Select * from CI_INFOOBJECTS Where SI_INSTANCE=0 And SI_ID='13399'");
oInfoObject = (IInfoObject) oInfoObjects.get(0);

//cast the InfoObject as a Report Object
IReport oReport = (IReport)oInfoObject;

IReportLogon rptLogon = (IReportLogon) oReport.getReportLogons().get(0);

rptLogon.setOriginalDataSource(true);
//rptLogon.setOriginalDataSource(false);
rptLogon.setPromptOnDemandViewing(false);
rptLogon.setUserName("User***");
rptLogon.setPassword("Pass***");
//rptLogon.setCustomUserName("CusUser***");
//rptLogon.setCustomPassword("CusPass***");

boInfoStore.commit(oInfoObjects);
System.out.println(reportName + "'s logon information has been reset successfully.");

} catch (SDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



}

}

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24167472/viewspace-1037952/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24167472/viewspace-1037952/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值