Showing posts with label reference. Show all posts
Showing posts with label reference. Show all posts

Sunday, March 25, 2012

Access COM+ component through embedded code

I am trying to access a COM+ component through embedded code of my
report. I added the reference to my COM+ component and a reference to
EnterpriseServices in the report. I also added the following to
rssrvpolicy.config:
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="GPATS_BO"
Description="This code group grants permissions to
GPATS_BO.dll full trust. ">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="<value>"
/>
</CodeGroup>
I also added the following line to my assembly:
<Assembly: System.Security.AllowPartiallyTrustedCallers()>
Here is the function that I am trying to call:
<System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert,
Unrestricted:=True)> _
Public Function GetInvestmentTypeTest(ByVal partyId As Integer) As
String
Try
Return "IT WORKED"
Catch ex As Exception
Throw ex
End Try
End Function
I get the following error:
System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.SecurityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
at
System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
at ReportExprHostImpl.CustomCodeProxy.GetInvestmentTypeTest(Int32
partyId)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The Zone of the assembly that failed was:
MyComputer
I can get the value and it uses the COM+ component when it is run in
the IDE and you preview the report. Once it is deployed and you try to
view it through the RS website, it gives the error above.
I am an admin on the machine and I even unchecked "Enforce access
checks for this application" in COM+ for this component, so permissions
really shouldn't be a problem. I also made the account that reporting
services runs under an admin on the machine and it didn't help (as I
suspected, but I had to try anyway).
I tried the same steps but with a dll not in COM+ (except I also copied
the dll into the folder "C:\Program Files\Microsoft SQL
Server\MSSQL.3\Reporting Services\ReportServer\bin\") and it works fine
both locally and when deployed.
Is it even possible for a report to use a COM+ component? The reason I
ask is that the application and the reports use many common functions.
I really don't want 2 dlls with the same code, so we are trying to make
Reporting Services use the component.Is there anyone that has tried this before? I see a few posts on the
subject, but no resolution. Thanks for any help anyone can give on
this issue.
Devin
Devin wrote:
> I am trying to access a COM+ component through embedded code of my
> report. I added the reference to my COM+ component and a reference to
> EnterpriseServices in the report. I also added the following to
> rssrvpolicy.config:
> <CodeGroup
> class="UnionCodeGroup"
> version="1"
> PermissionSetName="FullTrust"
> Name="GPATS_BO"
> Description="This code group grants permissions to
> GPATS_BO.dll full trust. ">
> <IMembershipCondition
> class="StrongNameMembershipCondition"
> version="1"
> PublicKeyBlob="<value>"
> />
> </CodeGroup>
>
> I also added the following line to my assembly:
> <Assembly: System.Security.AllowPartiallyTrustedCallers()>
>
> Here is the function that I am trying to call:
> <System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert,
> Unrestricted:=True)> _
> Public Function GetInvestmentTypeTest(ByVal partyId As Integer) As
> String
> Try
> Return "IT WORKED"
> Catch ex As Exception
> Throw ex
> End Try
> End Function
>
> I get the following error:
> System.Security.SecurityException: Request for the permission of type
> 'System.Security.Permissions.SecurityPermission, mscorlib,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
> failed.
> at
> System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type
> serverType)
> at
> System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
> serverType, Object[] props, Boolean bNewObj)
> at ReportExprHostImpl.CustomCodeProxy.GetInvestmentTypeTest(Int32
> partyId)
> The action that failed was:
> Demand
> The type of the first permission that failed was:
> System.Security.Permissions.SecurityPermission
> The Zone of the assembly that failed was:
> MyComputer
>
> I can get the value and it uses the COM+ component when it is run in
> the IDE and you preview the report. Once it is deployed and you try to
> view it through the RS website, it gives the error above.
> I am an admin on the machine and I even unchecked "Enforce access
> checks for this application" in COM+ for this component, so permissions
> really shouldn't be a problem. I also made the account that reporting
> services runs under an admin on the machine and it didn't help (as I
> suspected, but I had to try anyway).
> I tried the same steps but with a dll not in COM+ (except I also copied
> the dll into the folder "C:\Program Files\Microsoft SQL
> Server\MSSQL.3\Reporting Services\ReportServer\bin\") and it works fine
> both locally and when deployed.
> Is it even possible for a report to use a COM+ component? The reason I
> ask is that the application and the reports use many common functions.
> I really don't want 2 dlls with the same code, so we are trying to make
> Reporting Services use the component.

Thursday, March 8, 2012

Abstracting cross-databases references with views

On our SQL Server, the databases reference each other quite often. eg. UPDAT
E
SalesDatabase..DailySales SET Flag = 1. We are planning to change that so
that all references to other databases are done through views, because we
want to abstract and centralise all the cross-database references.
So we'll end up with
CREATE View as SELECT * FROM SalesDatabase..DailySales
UPDATE DailySales SET Flag = 1
My question is this. By going through a view, will this have any impact on
performance ?
Thanks, CraigGraig
Generally speaking views are not about performance. Views are about
security. If a performance is important to you I'd suggest to use a stored
procedure instead and make sure that you jave properly defined indexes on
the table.
"Craig HB" <CraigHB@.discussions.microsoft.com> wrote in message
news:B6A50E38-BCF3-44F1-9179-DE653A340655@.microsoft.com...
> On our SQL Server, the databases reference each other quite often. eg.
> UPDATE
> SalesDatabase..DailySales SET Flag = 1. We are planning to change that so
> that all references to other databases are done through views, because we
> want to abstract and centralise all the cross-database references.
> So we'll end up with
> CREATE View as SELECT * FROM SalesDatabase..DailySales
> UPDATE DailySales SET Flag = 1
> My question is this. By going through a view, will this have any impact on
> performance ?
> Thanks, Craig|||I do use stored procedures and all the tables are indexed.
What I'm not sure about is whether performance will be affected if instead
of selecting / updating / deleting from a table that exists in another
database, I select / update / delete from a local view that selects from tha
t
table in the other database. The SQL I'm talking about would be in a stored
procedure.
BEFORE:
create proc Proc1 as UPDATE OtherDatabase..Sales SET Flag = 1
AFTER:
create view Sales as SELECT ProductID, SalesQty, SalesAmt, Flag FROM
OtherDatabase..Sales
create proc Proc1 as UPDATE Sales SET Flag = 1
The reason for doing is specific to our applications and that is not what I
am asking. What I need to know is whether doing this will affect perfomance.
An extra question is : would the stored procedure (that calls the local view
that calls the table in the other database) be able to use the indexes in th
e
table or would the view in between prevent that from happening.
Any help would be greatly appreciated,
Craig

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS
It is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS
|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs, and look for your job that is backing up to your tape drive (you may also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there should be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from a text file, find that text file and search it for references to your erroneous database.
I have the same error right now, but it's for databases that do exist. It turns out that when we had a crash the other week, the CD ROM was removed from my server, resulting in my secondary HDD moving from F:\ to E:\. Obviously the files for some of my existing databases cannot be found. It just shows that this error message usually means exactly what it says.
If you cannot find the file it is looking for, I suggest creating a text file of the same name and location (it couldn't hurt!!), and let it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQL Servers have, so exercise CAUTION. Cheers.|||This has to do with the Intelligent Disaster Recovery feature of Backup Exec. The fix, detailed here, is creating a directory named 'backup' under the MSSQL$BKUPEXEC directory.

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTSIt is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs,
and look for your job that is backing up to your tape drive (you may
also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there should
be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from a
text file, find that text file and search it for references to your
erroneous database.
I have the same error right now, but it's for databases that do exist.
It turns out that when we had a crash the other week, the CD ROM was
removed from my server, resulting in my secondary HDD moving from F:\
to E:\. Obviously the files for some of my existing databases cannot be
found. It just shows that this error message usually means exactly what
it says.
If you cannot find the file it is looking for, I suggest creating a
text file of the same name and location (it couldn't hurt!!), and let
it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQL
Servers have, so exercise CAUTION. Cheers.
smithy
---
Posted via http://www.mcse.ms
---
View this thread: http://www.mcse.ms/message599918.html

Absolutely Bizarre - Backup reference database that doesn't exist

Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTSIt is probably a Veritas specific issue, I haven't seen it before. Worth
speaking to Veritas support.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Jeffrey Sheldon" <jsheldon@.projecthope.org> wrote in message
news:356301c4293f$602b5eb0$a101280a@.phx.gbl...
Ok folks try this one on. Each night during our Tape
backup the following error occurs in SQL logs
I/O error on backup or restore restart-checkpoint
file 'd:\MSSQL\backup\model4IDR.ckp'. Operating system
error 3(The system cannot find the path specified.). The
statement is proceeding but is non-restartable.
The kicker? We do not have a database called model4IDR.
In sysdatabases there is no such thing and we do not
understand where the backup is getting this info (veritas)
Any ideas to point me in the right direction?
thanks
JTS|||In Enterprise Manager, expand to Management > SQL Server Agent > Jobs
and look for your job that is backing up to your tape drive (you ma
also try under Management > Database Maintenance Plans).
Have a look in the Steps tab of this jobs Properties, and there shoul
be a Step referring to model4IDR.ckp.
Alternatively, if your maintenance plan gets its instructions from
text file, find that text file and search it for references to you
erroneous database.
I have the same error right now, but it's for databases that do exist
It turns out that when we had a crash the other week, the CD ROM wa
removed from my server, resulting in my secondary HDD moving from F:
to E:\. Obviously the files for some of my existing databases cannot b
found. It just shows that this error message usually means exactly wha
it says.
If you cannot find the file it is looking for, I suggest creating
text file of the same name and location (it couldn't hurt!!), and le
it find that.
Lastly, that DB name looks TOO MUCH like the model db that all SQ
Servers have, so exercise CAUTION. Cheers
-
smith
----
Posted via http://www.mcse.m
----
View this thread: http://www.mcse.ms/message599918.htm