We have been asked for the following requirement :
Users want to be able to switch universe connexion to avoid people macking queries during corresponding database loading times.
In former v4/5/6, it was possible to use a piece of sql to dynamicaly switch the univers connexion from one to another but it is not longer possible on XI ? have you already met such requirement ? Any ideas ?
The basic steps required are:
[list]Query for the universe objects and cast them to IUniverse
Call the getDataConnections() method which returns a set of connection IDs
Delete the contents of the sets and add the new connection ID[/list]
Here is a quick snippet I put together a while back:
// Get ID for the new connection
String query = "SELECT SI_ID, SI_NAME FROM CI_APPOBJECTS WHERE SI_KIND = '" + CeKind.DATACONNECTION + "' AND SI_NAME = '" + NEWCONN + "'";
int connID = ((IInfoObject)Utils.getInfoObjects(infoStore, query).get(0)).getID();
// Get universes to change
query = "SELECT SI_ID, SI_NAME, SI_DATACONNECTION FROM CI_APPOBJECTS WHERE SI_KIND = 'universe' AND SI_NAME IN (" + Utils.join(UNVNAMES, ",", "'") + ")";
IInfoObjects unvs = Utils.getInfoObjects(infoStore, query);
for (Object o : unvs) {
IUniverse unv = (IUniverse)o;
Set<Integer> conns = unv.getDataConnections();
// Check to see if the universe had a connection
String oldConn = "[no connection]";
if (conns.size() != 0)
oldConn = Utils.getConnectionName(conns.iterator().next(), infoStore);
conns.clear();
conns.add(connID);
System.out.println(unv.getTitle() + " connection changed from " + oldConn + " to " + NEWCONN);
}
infoStore.commit(unvs);
System.out.println("Complete");
“Utils” is a custom utility class I put together to handle repetitive tasks.
Is it possible to change universes if a webi doc have multiples dataproviders with differents universes. Did you tried, is it just the universe order we must keep?
I post in this topic because i have a similar problem.
I 'm working on VB6 on a projet which we import or export universes between severals clients on different server.
i want to change my connection and have a shared connection because of these clients have to open my universes after import/export of th universe.
As well as i began vb6 and business objects for a few time, i need help.
I saw my bff jill’s code but i didn’t understand it.
I looked at SDK Designer Universe but there are not help or something about Connection property.
Sub Switch_Unv_Cx()
Dim CMSName As String
Dim DesApp As Designer.Application
Dim DesCx As Designer.Connections
Dim DesUnis As Designer.Universes
Dim DesUniAdHoc As Designer.Universe
Dim UnvName As String
UnvName = "TST_SWITCH"
Set DesApp = New Designer.Application
Call DesApp.Logon(bologin, bopwd, CMSName, "secEnterprise")
DesApp.Window.State = dsMinimized
DesApp.Visible = True
DesApp.Interactive = False
Set DesUnis = DesApp.Universes
Call DesUnis.OpenFromEnterprise("ADM", UnvName, 0)
If DesUnis.Item(1).Connection = "CX_BASE_PROD" Then
DesUnis.Item(1).Connection = "CX_DATAWARE"
Call DesUnis.Item(1).SaveAsEx(UnvName)
DesUnis.Item(1).Close
Call DesApp.Universes.Export("ADM", UnvName, 0)
DesApp.Quit
MsgBox "Switched connexion for univers " + "ADM/" + UnvName + " : CX_BASE_PROD > CX_DATAWARE"
Exit Sub
End If
If DesUnis.Item(1).Connection = "CX_DATAWARE" Then
DesUnis.Item(1).Connection = "CX_BASE_PROD"
Call DesUnis.Item(1).SaveAsEx(UnvName)
DesUnis.Item(1).Close
Call DesApp.Universes.Export("ADM", UnvName, 0)
DesApp.Quit
MsgBox "Switched connexion for univers " + "ADM/" + UnvName + " : CX_DATAWARE > CX_BASE_PROD"
Exit Sub
End If
End Sub
[quote:398ba026c4=“jp.golay”]
Is it possible to change universes if a webi doc have multiples dataproviders with differents universes. Did you tried, is it just the universe order we must keep?
[/quote]
Sorry, the reports I changed were very simple with just 1 data provider each so I’m not sure.
is Shared connection allowing another person to open my universe?
In fact, my universe will be copied in a folder on server, then since this folder, it will be exporting on client repository. So i could open universe in my designer, and same thing for the client. For that i have two service developed with VB6.