ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【BO-SDK】Update Database information for .rpt

【BO-SDK】Update Database information for .rpt

原创 Linux操作系统 作者:xiangjinling 时间:2010-09-08 15:23:27 0 删除 编辑

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 InfoObjects=null;
IInfoObject InfoObject=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 Report = (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();
}



}

}

http_imgload2.jpg

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

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-06-29

  • 博文量
    19
  • 访问量
    26370