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("guest"); newConnectionInfo.setPassword("bobobo");
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("guest"); newConnectionInfo.setPassword("bobobo"); try { databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo, null, DBOptions._useDefault); } catch (ReportSDKException error) { System.out.println(error.getSDKError()); } }
Business Objects, an SAP company http://www.businessobjects.com/ Support services http://www.businessobjects.com/services/support/ Product Documentation on the Web http://support.businessobjects.com/documentation/ |