cancel
Showing results for 
Search instead for 
Did you mean: 

Set "Use same database logon as when report is run" from SDK

Former Member
0 Kudos

Hi,

Is it possible to change the setting mentioned in the title via Java SDK?

Currently I am able to change it via CMC.

I found an example which has IReportLogon.setPromptOnDemandViewing(boolean promptOnDemand), the description of this method seems to be what I am looking for, however it doesn't change the setting after running the code below, everything else seems to have updated when I checked the report's Database Configuration on CMC. There is no error.


public static void changeDatabaseConfiguration(String reportName) {

  IEnterpriseSession enterpriseSession=null;

  try {

  enterpriseSession=getEnterpriseSession();

  IInfoStore infoStore=(IInfoStore)enterpriseSession.getService("InfoStore");

  IInfoObjects infoObjects=infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_INSTANCE=0 and si_kind='CrystalReport'");

  IInfoObject infoObject=null;

  for (int i=0; i<infoObjects.size(); i++) {

  infoObject=(IInfoObject)infoObjects.get(i);

  if (infoObject.getTitle().equalsIgnoreCase(reportName)&&infoObject.getParent().getTitle().equalsIgnoreCase(CRS_USER_ID)) {

  IReport rep=(IReport)infoObject;

  ISDKList boReportLogons=rep.getReportLogons();

  IReportLogon boReportLogon=(IReportLogon)boReportLogons.get(0);

  boReportLogon.setOriginalDataSource(false);

  boReportLogon.setCustomServerType(CeReportServerType.ORACLE);

  boReportLogon.setCustomServerName(CRS_USER_ID);

  boReportLogon.setCustomUserName(DB_USER_ID);

  boReportLogon.setCustomPassword(DB_USER_PASSWORD);

  boReportLogon.setPromptOnDemandViewing(false);

  infoStore.commit(infoObjects);

  }

  }

  } catch (Exception e) {

  e.printStackTrace();

  } finally {

  if (enterpriseSession!=null) {

  enterpriseSession.logoff();

  }

  }

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You might want to test update the property 'SI_LOGON_MODE' and setting the value to 1 and check if it checks the

'Use same database logon as when report is run' option.  The SI_LOGON_MODE is under SI_LOGON_INFO.

You might run the query 'select * from ci_infoobjects where si_kind='crystalreport' and si_id=reportid' in query builder(Admin Tools) and check the above properties as well.

If you want to restrict users to change the password, try setting the value as false for the property bag 'SI_DBLOGONCONFIGURABLE'.

Below is a sample snippet.

========================

ProcessingInfo iproc=(IProcessingInfo)oInfoObject.getProcessingInfo();

IProperties tmpProp=(IProperties)iproc.properties();

IProperty p=tmpProp.getProperty("SI_DBLOGONCONFIGURABLE");

p.setValue(false);

iStore.commit(oInfoObjects);

===========================

I would also try to get an environment and test the same.

Test with a single sample report first, before trying with all the reports.

Thanks,

Prithvi

Message was edited by: Prithviraj Shekhawat

Former Member
0 Kudos

Hi Prithviraj,

Thanks for the help answer, the SI_DBLOGONCONFIGURABLE part is working as I wanted it.

As for changing the SI_LOGON_MODE to 1, I checked in querybuilder the value is currently 0, but I'm having difficulty getting the property and setting the value. I only managed to get the highest level which is SI_LOGON_INFO, how do I get the nested levels? Anyway I'm still trying.

Former Member
0 Kudos

You can use the below snippet as a prototype which shows how you can get the nested properties and set values for the same.

IInfoObject oInfoObject=(IInfoObject)oInfoObjects.get(0);

IProperties props=(IProperties)oInfoObject.properties();

IProperties reportLogonProps=(IProperties)props.getProperties("SI_LOGON_INFO");

if(reportLogonProps != null)

   {

   IProperty numOfLogon=(IProperty)reportLogonProps.getProperty("SI_NUM_LOGONS");

  

   if(numOfLogon != null)

   {

   String numOfLogonValue=numOfLogon.getValue().toString();

    Integer outputFile=new Integer(numOfLogonValue);

    for(int j=1 ; j<=outputFile.intValue() ; j++)

    {

    IProperties logonProperties= reportLogonProps.getProperties("SI_LOGON"+j);

    IProperty logonModeProperty=logonProperties.getProperty("SI_LOGON_MODE");

    logonModeProperty.setValue("1");

    }

    }

   }

infostore.commit(oInfoObjects);

Thnaks,

Prithvi

Former Member
0 Kudos

Hi Prithviraj,


Thanks for the code snippet, I modified a bit because my IProperties does not have a getProperties method, probably because my jar files are not the newer versions, following modified version works for me, however I am puzzled by one thing, refer to line 22, the #3942# is actually SI_LOGON_MODE, I change it to 1 and it does change the setting to the one I wanted, if I try to get property by "SI_LOGON_MODE", it is null. So it's kind of weird if I have to update by this #3942# which could be a different number on a different server.



public static void viewSetReportSiPropertiesTest(String reportName) {

  IEnterpriseSession enterpriseSession=null;

  try {

  enterpriseSession=getEnterpriseSession();

  IInfoStore infoStore=(IInfoStore)enterpriseSession.getService("InfoStore");

  IInfoObjects infoObjects=infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_INSTANCE=0 and si_kind='CrystalReport'");

  IInfoObject infoObject=null;

  for (int i=0; i<infoObjects.size(); i++) {

  infoObject=(IInfoObject)infoObjects.get(i);

  if (infoObject.getTitle().equalsIgnoreCase(reportName)&&infoObject.getParent().getTitle().equalsIgnoreCase(CRS_USER_ID)) {

  IProperties properties=(IProperties)infoObject.getProcessingInfo().properties();

  IProperty SI_DBLOGONCONFIGURABLE=properties.getProperty("SI_DBLOGONCONFIGURABLE");

  SI_DBLOGONCONFIGURABLE.setValue(false);

  IProperty SI_LOGON_INFO=(IProperty)properties.getProperty("SI_LOGON_INFO");

  IProperties SI_LOGON_INFO_properties=(IProperties)SI_LOGON_INFO.getValue();

  IProperty SI_LOGON1=(IProperty)SI_LOGON_INFO_properties.getProperty("SI_LOGON1");

  IProperties SI_LOGON1_properties=(IProperties)SI_LOGON1.getValue();

  SI_LOGON1_properties.setProperty("#3942#", 1);

  SI_LOGON_INFO_properties.setProperty("SI_LOGON1", SI_LOGON1_properties);

  properties.setProperty("SI_LOGON_INFO", SI_LOGON_INFO_properties);

  infoStore.commit(infoObjects);

  }

  }

  } catch (Exception e) {

  e.printStackTrace();

  } finally {

  if (enterpriseSession!=null) {

  enterpriseSession.logoff();

  }

  }

  }



Former Member
0 Kudos

Which version are you on? getProperties() method is available in XI 3.1, 4.0 and 4.1. You can refer to the api guide available at help.sap.com for the same.

I do not understand the purpose of line number 4,5,6 &7.

Once you get SI_LOGON1, you have to get the property SI_LOGON_MODE and set the value for this.

  1. IProperty SI_LOGON_INFO=(IProperty)properties.getProperty("SI_LOGON_INFO"); 
  2.   IProperties SI_LOGON_INFO_properties=(IProperties)SI_LOGON_INFO.getValue(); 
  3.   IProperty SI_LOGON1=(IProperty)SI_LOGON_INFO_properties.getProperty("SI_LOGON1"); 
  4.   IProperties SI_LOGON1_properties=(IProperties)SI_LOGON1.getValue(); 
  5.   SI_LOGON1_properties.setProperty("#3942#", 1); 
  6.   SI_LOGON_INFO_properties.setProperty("SI_LOGON1", SI_LOGON1_properties); 
  7.   properties.setProperty("SI_LOGON_INFO", SI_LOGON_INFO_properties); 

Also from where did you get the value '#3942#'

Thanks,

Prithvi

akolesnikov
Explorer
0 Kudos

Hello Prithviraj,

I’m following your posts, and learning a lot but still not “there” yet, since do not have programming experience. But facing urgent issue, and hoping for your advice.

How update Database Configuration with new password credentials for all Oracle usernames
that used on our 200+ canned Crystal reports.

  Thank you and look forward to hear from you.

My direct email: akolesnikov   @  misoenergy.org

Former Member
0 Kudos

Hi Prithviraj,

I checked the manifest file of my cecore.jar:

Manifest-Version: 1.0

Ant-Version: Apache Ant 1.5.3

Created-By: 1.4.1_03-b02 (Sun Microsystems Inc.)

Product-Name: Crystal Enterprise Java SDK (C)

Implementation-Title: Crystal Enterprise SDK core

Implementation-Version: 11.5.10.1263

Implementation-Vendor: Business Objects, Inc.(C)

I am not sure what BI version it is under but it is from the Crystal Server 11.5 (XI R2); for your info, our production server is running XI R2.

This is what the IProperties.class looks like after decompiling:


package com.crystaldecisions.sdk.properties;

import java.util.Map;

public abstract interface IProperties

  extends Map

{

  public abstract IProperty add(Object paramObject1, Object paramObject2, int paramInt);

 

  public abstract IProperty getProperty(Object paramObject);

 

  public abstract void setProperty(Object paramObject1, Object paramObject2);

 

  public abstract void setProperty(Object paramObject, int paramInt);

 

  public abstract void setProperty(Object paramObject, long paramLong);

 

  public abstract void setProperty(Object paramObject, boolean paramBoolean);

}

As you can see, it does not have a getProperties method so I had to do it the weird way that I did but it works though.

As for the #3942#, it is actually SI_LOGON_MODE (I confirmed by setting it to 1 as you advised and it indeed changed the setting to the one I wanted in CMC), I got it by displaying the properties of SI_LOGON1.

I wonder why only SI_LOGON_MODE property is displayed as a number instead of the SI_ naming convention, but from query builder, it is showing as SI_LOGON_MODE, very weird.

Former Member
0 Kudos

Hi Wei,

As you are using XI R2 there can be a difference to the methods used by IProperties interface. And your study proves the same. I was referring to XI 3.1 libraries, as XI R2 has reached EOL long back and is out of support now.

However its good that you are able to set the property and it works as expected.

Regarding your query

'I wonder why only SI_LOGON_MODE property is displayed as a number instead of the SI_ naming convention, but from query builder, it is showing as SI_LOGON_MODE, very weird.'

Every infoobject in businessobjects is associated with a set of properties. Now there can be properties which have a direct value for example SI_NAME, SI_ID and soon and there are properties which have subproperty bags associated to them.

Eventually every propertybag is associated a value. SI_LOGON property bag has a set of values which is then divided into sub properties and each subproperty is assigned a value. This is an internal mechanism handled by BO which assigns the properties.

I believe it was not confusing.

Thanks,

Prithvi

Former Member
0 Kudos

Hi Alexandr,

Need more information.

1. BusinessObjects Product Version.

2. Are the reports managed(publsihed to businessobjects enterprise) or unmanaged.

3. Are you looking to update the the original database configuration or custom database configuration.

4. Were you able to change the password from designer.

Please provide the information and open a new thread so that it becomes specific to your issue and any one from the group would be able to help.

Thanks,

Prithvi

Former Member
0 Kudos

Hi Prithviraj,


Really appreciate your explanation, so what I'll do is to try and get that value before I try to do any update, awkward but better than nothing.


Thanks!

Answers (0)