Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
harald_kuersten
Associate
Associate
0 Kudos
694

Being able to also transport BusinessObjects content from one system to another, as outlined in my previous post, was a big step forward to achieving complete continuous delivery. But a few things still need some polishing up.

For instance, when using this method to transport connection objects, you end up with connections pointing to the development backend - assuming you have separate backends for the various environments (i.e. DEV/QA/STAG/TEST/PROD). But we all have that, right? :wink:

To fix this, we call yet another little tool in our delivery pipeline to fix the connection properties in each environment after deployment. And again, we use the Java API for SAP BusinessObjects BI.


As usual, a session and handle to the InfoStore will be needed:


IEnterpriseSession enSession =

  CrystalEnterprise.getSessionMgr().logon("cmsuser", "cmspasswd", "cmshost:cmsport", IsecEnterprise.KIND);

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


Then we retrieve the connection object we wish to modify:


String query =

  "SELECT * FROM CI_APPOBJECTS WHERE SI_KIND = 'CCIS.DataConnection' AND SI_NAME = 'myConnection'";

IInfoObjects connObjects = infoStore.query(query);


IDataConnection dataConnection =

  (IDataConnection) connObjects.get(0);  # maybe some error handling?

Connection conn = dataConnection.getConnection();


To modify the connection, it first needs to be cast to MutableConnection. Only then can we change the properties and save the object:

MutableConnection mutConn = (MutableConnection) conn;

mutConn.putProperty(

  PropertySet.DATASOURCE,

  PropertySet.Entry.CATEGORY_CREDENTIALS,

  PropertySet.Entry.TYPE_STRING, "qaEnvHost:qaEnvPort");

mutConn.putProperty(

  "URL",

  PropertySet.Entry.CATEGORY_CREDENTIALS,

  PropertySet.Entry.TYPE_STRING, "jdbc:sap://qaEnvHost:qaEnvPort");

mutConn.putProperty(

  PropertySet.USER,

  PropertySet.Entry.CATEGORY_CREDENTIALS,

  PropertySet.Entry.TYPE_STRING, "DBUSER");

mutConn.putProperty(

  PropertySet.PASSWORD,

  PropertySet.Entry.CATEGORY_CREDENTIALS,

  PropertySet.Entry.TYPE_STRING, "DBPASSWD");

dataConnection.setConnection(mutConn);

dataConnection.save();

Using this after deployment in each environment, we ensure that the connection object will point to the correct backend.

There are also other things which need to be changed after deployment (e.g. permissions on objects) - I'll try to cover that in a separate post...sometime...