SetDatabaseConnection Method (WMI MSReportServer_ConfigurationSetting Class)
Sets the report server database connection to a particular report server database.
Public Sub SetDatabaseConnection(Server as String, DatabaseName as string, CredentialsType as Integer, Username as String, Password as String, ByRef HRESULT as Int32)
The name of the SQL Server instance that is used to host the report server database.
The name of the report server database.
The type of credentials to use for the connection. Values can be:
0 - Windows
1 – SQL Server
2 - Windows Service
- 0 - Windows
The account name used to connect to the report server database.
The password used to connect to the report server database.
[out] Value indicating whether the call succeeded or failed.
When the CredentialsType parameter is set to 0 (Windows), the UserName and Password parameters must be set. The UserName parameter must be in the form "domain\username", and the value must represent a valid Windows logon.
When the CredentialsType parameter is set to 1 (SQL Server), the value passed in the UserName parameter must conform to the requirements of a SQL Server login name.
When the CredentialsType parameter is set to 2 (Windows Service), the report server uses integrated security to connect to the report server database and the UserName and Password parameters are ignored. The Reporting Server Web service will use either the ASP.NET account or an application pool’s account and the Windows service account to access the report server database.
When called, the SetDatabaseConnection method encrypts and stores the credentials and database information in the configuration file for the specified report server.
The SetDatabaseConnection method does not check that the report server can connect to the report server database using the data specified.
The SetDatabaseConnection method does not grant permissions to the specified account(s). You must call the GenerateDatabaseRightsScript method for each account that requires access to the report server database and run the resulting script.
Platform: Windows Server 2003, Datacenter Edition; Windows Server 2003, Enterprise Edition; Windows Server 2003, Standard Edition; Windows Vista; Windows XP Professional with Service Pack 2 (SP2) or Service Pack 1 (SP1); or Windows 2000 (all versions)