Hi All,
I try to update database logon user name & password, however, I don't know how to make it take effect. below is my code. I tried IReport.save and IInfoStore.commit both not working. Please help. And by the way is there any alternative approach to update password for all reports in server? We have annually password change, it's really bad to update password one by one. Thanks.
String CMS = "server:6400"; // CMS Name | |||
String UserID = "Administrator"; // Administrator User Account | |||
String Password = "***"; // Administrator Password | |||
ISessionMgr sm = CrystalEnterprise.getSessionMgr(); | |||
es = sm.logon(UserID, Password, CMS, "secEnterprise"); | |||
IInfoStore iStore = (IInfoStore) es.getService("", "InfoStore"); | |||
String sq = "select * from ci_infoobjects where si_name = 'REPORT_NAME' and si_kind in ('CrystalReport')"; |
IInfoObjects iObjects = iStore.query(sq); | ||||
IInfoObject iObject = null; | ||||
IReport rp = (IReport)iObjects.get(0); | ||||
String output = ">>>>Report Info = " + rp.getTitle() + "(ID: " + rp.getID() + ",CUID:" + rp.getCUID() + ")\n"; | ||||
if ( rp.getReportLogons() != null ) { | ||||
for (int j = 0; j < rp.getReportLogons().size(); j++) { |
IReportLogon reportLogon = (IReportLogon) rp.getReportLogons().get(j); | |||||
ConnectionInfo ci = reportLogon.getConnectionInfo(); | |||||
output += ">DB Logon Info_" + (j + 1) + ":"; | |||||
output += "Server:" + ci.getAttributes().getStringValue("Server Name"); | |||||
output += ",User Name:" + ci.getUserName(); | |||||
output += ",Password:" + ci.getPassword() + "\n"; | |||||
ci.setUserName("abc"); | |||||
ci.setPassword("abc$01"); | |||||
rp.save(); | |||||
} | |||||
} | |||||
System.out.println(output); |