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

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

转载自:http://blog.itpub.net/post/42444/504970  惊翎轩 

 

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

【for Java】

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();
		}
	}
}

  

转载于:https://www.cnblogs.com/javhu/archive/2013/03/20/cyue_BOE_Update_Database_Info.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值