If you get the exception:
{"System.Web.Services.Protocols.SoapException: Cannot create a connection to data source ”. —> Microsoft.ReportingServices.Diagnostics.Utilities.DataSourceOpenException: Cannot create a connection to data source ”. —> Microsoft.ReportingServices.DataExtensions.ReportServerDataProvider.RSDPException: You have specified integrated security or credentials in the connection string for the data source, but the data source is configured to use a different credential type. To use the values in the connection string, you must configure the unattended report processing account for the report server.\n at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.PrepareQuery(DataSource DataSource, DataSetDefinition DataSet, DataSetDefinition& DataSettings, Boolean& Changed, String[]& ParameterNames)\n at Microsoft.ReportingServices.WebServer.ReportingService2005.PrepareQuery(DataSource DataSource, DataSetDefinition DataSet, DataSetDefinition& DataSettings, Boolean& Changed, String[]& ParameterNames)"}
Removing : integrated security=true from mine connection string solved this exception, but then an other exception occurred:
{"System.Web.Services.Protocols.SoapException: Cannot create a connection to data source ”. —> Microsoft.ReportingServices.Diagnostics.Utilities.DataSourceOpenException: Cannot create a connection to data source ”. —> System.Data.SqlClient.SqlException: Login failed for user ‘TTUser’.\n at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.PrepareQuery(DataSource DataSource, DataSetDefinition DataSet, DataSetDefinition& DataSettings, Boolean& Changed, String[]& ParameterNames)\n at Microsoft.ReportingServices.WebServer.ReportingService2005.PrepareQuery(DataSource DataSource, DataSetDefinition DataSet, DataSetDefinition& DataSettings, Boolean& Changed, String[]& ParameterNames)"}
This can be caused by getting a datasourcedefinition instead of creating a datasourcedefinition. When getting a datasourcedefinition the Password will be reset to NULL, resetting the password solves this exception:
// Get the shared datasource. DataSourceDefinition dataSourceDefinition = rs.GetDataSourceContents(“TestSharedDataSource”); // Reset password dataSourceDefinition.Password = “mypassword”;