DatabaseController databaseController = rcd.getDatabaseController();
ConnectionInfos connectionInfos = (ConnectionInfos)databaseController.getConnectionInfos(null);
IConnectionInfo oldConnectionInfo = connectionInfos.getConnectionInfo(0);
IConnectionInfo newConnectionInfo = new ConnectionInfo(); newConnectionInfo.setKind(ConnectionInfoKind.SQL);
PropertyBag newProperties = new PropertyBag(); newProperties.putStringValue("DSN", "Xtreme Sample Database 2005"); newProperties.put("UseDSNProperties", false); newProperties.putStringValue(PropertyBagHelper.CONNINFO_SERVER_NAME, "Xtreme Sample Database 2005"); newProperties.putStringValue(PropertyBagHelper.CONNINFO_SERVER_TYPE, "ODBC (RDO)"); newProperties.putStringValue(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_odbc.dll");
newConnectionInfo.setAttributes(newProperties);
newConnectionInfo.setUserName("username"); newConnectionInfo.setPassword("password");
try { databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo, null, DBOptions._useDefault); } catch (ReportSDKException error) { System.out.println(error.getSDKError()); }
void changeDataSource(ReportClientDocument rcd) { DatabaseController databaseController = rcd.getDatabaseController(); ConnectionInfos connectionInfos = (ConnectionInfos)databaseController.getConnectionInfos(null); IConnectionInfo oldConnectionInfo = connectionInfos.getConnectionInfo(0); IConnectionInfo newConnectionInfo = new ConnectionInfo(); newConnectionInfo.setKind(ConnectionInfoKind.SQL); PropertyBag newProperties = new PropertyBag(); newProperties.putStringValue("DSN", "Xtreme Sample Database 2005"); newProperties.put("UseDSNProperties", false); newProperties.putStringValue(PropertyBagHelper.CONNINFO_SERVER_NAME, "Xtreme Sample Database 2005"); newProperties.putStringValue(PropertyBagHelper.CONNINFO_SERVER_TYPE, "ODBC (RDO)"); newProperties.putStringValue(PropertyBagHelper.CONNINFO_DATABASE_DLL, "crdb_odbc.dll"); newConnectionInfo.setAttributes(newProperties); newConnectionInfo.setUserName("username"); newConnectionInfo.setPassword("password"); try { databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo, null, DBOptions._useDefault); } catch (ReportSDKException error) { System.out.println(error.getSDKError()); } }
SAP BusinessObjects http://www.sap.com/sapbusinessobjects/ Support services http://service.sap.com/bosap-support/ Product Documentation on the Web http://help.sap.com/ |