Hi,
I would like to change the credentials that are used at run time by the
reportserver service to connect to the SQL Server instance.
Can anybody please help me?
Regards!!Cookie =EB=FA=E1:
> Hi,
> I would like to change the credentials that are used at run time by the
> reportserver service to connect to the SQL Server instance.
> Can anybody please help me?
> Regards!!
http://support.microsoft.com/?id=3D306158
Impersonate a Specific User in Code
To impersonate a specific user only when you run a particular section
of code, use the following code:
<%@. Page Language=3D"C#"%>
<%@. Import Namespace =3D "System.Web" %>
<%@. Import Namespace =3D "System.Web.Security" %>
<%@. Import Namespace =3D "System.Security.Principal" %>
<%@. Import Namespace =3D "System.Runtime.InteropServices" %>
<script runat=3Dserver>
public const int LOGON32_LOGON_INTERACTIVE =3D 2;
public const int LOGON32_PROVIDER_DEFAULT =3D 0;
WindowsImpersonationContext impersonationContext;
[DllImport("advapi32.dll")]
public static extern int LogonUserA(String lpszUserName,
String lpszDomain,
String lpszPassword,
int dwLogonType,
int dwLogonProvider,
ref IntPtr phToken);
[DllImport("advapi32.dll", CharSet=3DCharSet.Auto, SetLastError=3Dtrue)]
public static extern int DuplicateToken(IntPtr hToken,
int impersonationLevel,
ref IntPtr hNewToken);
[DllImport("advapi32.dll", CharSet=3DCharSet.Auto, SetLastError=3Dtrue)]
public static extern bool RevertToSelf();
[DllImport("kernel32.dll", CharSet=3DCharSet.Auto)]
public static extern bool CloseHandle(IntPtr handle);
public void Page_Load(Object s, EventArgs e)
{
if(impersonateValidUser("username", "domain", "password"))
{
//Insert your code that runs under the security context of a specific
user here.
undoImpersonation();
}
else
{
//Your impersonation failed. Therefore, include a fail-safe mechanism
here.
}
}
private bool impersonateValidUser(String userName, String domain,
String password)
{
WindowsIdentity tempWindowsIdentity;
IntPtr token =3D IntPtr.Zero;
IntPtr tokenDuplicate =3D IntPtr.Zero;
if(RevertToSelf())
{
if(LogonUserA(userName, domain, password, LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, ref token) !=3D 0)
{
if(DuplicateToken(token, 2, ref tokenDuplicate) !=3D 0)
{
tempWindowsIdentity =3D new WindowsIdentity(tokenDuplicate);
impersonationContext =3D tempWindowsIdentity.Impersonate();
if (impersonationContext !=3D null)
{
CloseHandle(token);
CloseHandle(tokenDuplicate);
return true;
}
}
}
}
if(token!=3D IntPtr.Zero)
CloseHandle(token);
if(tokenDuplicate!=3DIntPtr.Zero)
CloseHandle(tokenDuplicate);
return false;
}
private void undoImpersonation()
{
impersonationContext.Undo();
}
</script>
Showing posts with label reportserver. Show all posts
Showing posts with label reportserver. Show all posts
Thursday, March 29, 2012
Changing connection credentials
Labels:
changing,
connect,
connection,
credentials,
database,
instance,
microsoft,
mysql,
oracle,
reportserver,
run,
server,
service,
sql,
time
Sunday, February 19, 2012
Change ReportServer database
We have installed Reporting Services on a new server using the local
database. Now we want to point to a ReportServer database on another
database server.
How can we change the server used for the ReportServer database to point to
a different server?
Thanks
--
RickIn SQL 2005:
Open - Start/All Programs/Microsoft SQL Server 2005/Configuration
Tools/Reporting Services Configuration
This will open the Reporting Services Configuration Manager. Choose
"Database Setup" from the left column and set the server and database name.
In SQL 2000 run the following (see
http://www.sqlservercentral.com/columnists/mpearson/recoveryplanningforsqlreportingservices.asp for more info):
rsconfig -c -s<ServerName> -dReportServer -a<Authtype> -u<username>
-p<password>
<ServerName> is the new Server name <Authtype> is â'Windowsâ' or â'SQLâ'
authentication of the service account SQLRS will use to connect to the
ReportServer database <UserName> & <Password> is the name/password of the
service account mentioned above.
Eg : rsconfig -c â'sSQL01 -dReportServer -aWindows â'uSDM\svcSQLRS â'ppass@.word
rsconfig can be found in the C:\Program Files\Microsoft SQL
Server\80\Tools\Binn folder.
This assumes that the report services db is a restore of the original. If
it's different then it get's a little more complicated as encryption keys and
versions need to match.
"Rick" wrote:
> We have installed Reporting Services on a new server using the local
> database. Now we want to point to a ReportServer database on another
> database server.
> How can we change the server used for the ReportServer database to point to
> a different server?
> Thanks
> --
> Rick|||Thanks.
--
Rick
"Limey" wrote:
> In SQL 2005:
> Open - Start/All Programs/Microsoft SQL Server 2005/Configuration
> Tools/Reporting Services Configuration
> This will open the Reporting Services Configuration Manager. Choose
> "Database Setup" from the left column and set the server and database name.
> In SQL 2000 run the following (see
> http://www.sqlservercentral.com/columnists/mpearson/recoveryplanningforsqlreportingservices.asp for more info):
> rsconfig -c -s<ServerName> -dReportServer -a<Authtype> -u<username>
> -p<password>
> <ServerName> is the new Server name <Authtype> is â'Windowsâ' or â'SQLâ'
> authentication of the service account SQLRS will use to connect to the
> ReportServer database <UserName> & <Password> is the name/password of the
> service account mentioned above.
> Eg : rsconfig -c â'sSQL01 -dReportServer -aWindows â'uSDM\svcSQLRS â'ppass@.word
> rsconfig can be found in the C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn folder.
> This assumes that the report services db is a restore of the original. If
> it's different then it get's a little more complicated as encryption keys and
> versions need to match.
>
>
> "Rick" wrote:
> > We have installed Reporting Services on a new server using the local
> > database. Now we want to point to a ReportServer database on another
> > database server.
> >
> > How can we change the server used for the ReportServer database to point to
> > a different server?
> >
> > Thanks
> > --
> > Rick
database. Now we want to point to a ReportServer database on another
database server.
How can we change the server used for the ReportServer database to point to
a different server?
Thanks
--
RickIn SQL 2005:
Open - Start/All Programs/Microsoft SQL Server 2005/Configuration
Tools/Reporting Services Configuration
This will open the Reporting Services Configuration Manager. Choose
"Database Setup" from the left column and set the server and database name.
In SQL 2000 run the following (see
http://www.sqlservercentral.com/columnists/mpearson/recoveryplanningforsqlreportingservices.asp for more info):
rsconfig -c -s<ServerName> -dReportServer -a<Authtype> -u<username>
-p<password>
<ServerName> is the new Server name <Authtype> is â'Windowsâ' or â'SQLâ'
authentication of the service account SQLRS will use to connect to the
ReportServer database <UserName> & <Password> is the name/password of the
service account mentioned above.
Eg : rsconfig -c â'sSQL01 -dReportServer -aWindows â'uSDM\svcSQLRS â'ppass@.word
rsconfig can be found in the C:\Program Files\Microsoft SQL
Server\80\Tools\Binn folder.
This assumes that the report services db is a restore of the original. If
it's different then it get's a little more complicated as encryption keys and
versions need to match.
"Rick" wrote:
> We have installed Reporting Services on a new server using the local
> database. Now we want to point to a ReportServer database on another
> database server.
> How can we change the server used for the ReportServer database to point to
> a different server?
> Thanks
> --
> Rick|||Thanks.
--
Rick
"Limey" wrote:
> In SQL 2005:
> Open - Start/All Programs/Microsoft SQL Server 2005/Configuration
> Tools/Reporting Services Configuration
> This will open the Reporting Services Configuration Manager. Choose
> "Database Setup" from the left column and set the server and database name.
> In SQL 2000 run the following (see
> http://www.sqlservercentral.com/columnists/mpearson/recoveryplanningforsqlreportingservices.asp for more info):
> rsconfig -c -s<ServerName> -dReportServer -a<Authtype> -u<username>
> -p<password>
> <ServerName> is the new Server name <Authtype> is â'Windowsâ' or â'SQLâ'
> authentication of the service account SQLRS will use to connect to the
> ReportServer database <UserName> & <Password> is the name/password of the
> service account mentioned above.
> Eg : rsconfig -c â'sSQL01 -dReportServer -aWindows â'uSDM\svcSQLRS â'ppass@.word
> rsconfig can be found in the C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn folder.
> This assumes that the report services db is a restore of the original. If
> it's different then it get's a little more complicated as encryption keys and
> versions need to match.
>
>
> "Rick" wrote:
> > We have installed Reporting Services on a new server using the local
> > database. Now we want to point to a ReportServer database on another
> > database server.
> >
> > How can we change the server used for the ReportServer database to point to
> > a different server?
> >
> > Thanks
> > --
> > Rick
Subscribe to:
Posts (Atom)