Sunday, March 11, 2012

Accesing Oracle from an assembly!

Hi Group!
Iâ've a big problem with MS Reporting Services, i try to access an oracle
database from a custom assembly, in desing view all work nice, but in
production environment, the call to the class fail!.
What i can do to correct this problem?
I added the dll file to de bin folder or reportserver and report designer,
but donâ't work.
Really I need help.
Thanks for the helpCarlos,
It sounds like a CAS issue (Code Access Security)
Make sure you define (in the RS Policy file) definitions of the location and
the name of the Custome Assembly DLL's and what Rights you want to assign to
it.
RS provides very limited default "trust" of Custom Assemblies, you'll need
to define specific additions to this to allow access to the database.
Btw: Although it can be done, it's a little unusual to access the database
from a Custom Assembly - I normally see it done as an extension like a data
procesing extension.
HTH
- peteZ
"Carlos López." <CarlosLpez@.discussions.microsoft.com> wrote in message
news:A591ABD5-0838-4B99-88A3-43FBBE27FD49@.microsoft.com...
> Hi Group!
> I've a big problem with MS Reporting Services, i try to access an oracle
> database from a custom assembly, in desing view all work nice, but in
> production environment, the call to the class fail!.
> What i can do to correct this problem?
> I added the dll file to de bin folder or reportserver and report designer,
> but don't work.
> Really I need help.
> Thanks for the help
>|||You will need to assert FullTrust permissions to use the Oracle data
provider from a custom assembly. Below is an example of how to assert full
trust in your custom assembly using an attribute on the method that opens an
Oracle connection:
[PermissionSet(SecurityAction.Assert, Unrestricted=true)]
public foo()
{
// your code
strConn = "Data Source=TSD01;User ID=SchemaName;password=password;";
OracleConnection cn = new OracleConnection(strConn);
cn.Open();
// ...
}
Note: in addition to changing the code in the custom assembly, you will need
to modify the code policy config files to give your custom assembly full
trust permissions.
http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/dngrfCodeAccessSecurityInSQLServer2000ReportingServices.asp
There is a reason why you will need to assert FullTrust permissions: If you
read the MSDN documentation for the OraclePermission class and the
SqlClientPermission class and compare them, you will notice the following
statement:
"This class [i.e. OraclePermission] is intended for future use when the .NET
Framework Data Provider for Oracle is enabled for partial trust scenarios.
The provider currently requires FullTrust permission."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoracleclientoraclepermissionclasstopic.asp
I.e. asserting the OraclePermission won't help you get around the Security
exception, because the .NET data provider for Oracle _must_ have full trust
and does not work in a partially trusted environment. This is inherit to the
current design of the data provider and the Oracle client. Note: The managed
provider for SQL Server is enabled for partial trust scenarios, therefore it
is sufficient (and advisable) to just assert the SqlClientPermission when
using it in custom assemblies.
HTH,
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"PeteZ" <peteZ@.aol.com> wrote in message
news:OyiJok40EHA.3584@.TK2MSFTNGP11.phx.gbl...
> Carlos,
> It sounds like a CAS issue (Code Access Security)
> Make sure you define (in the RS Policy file) definitions of the location
and
> the name of the Custome Assembly DLL's and what Rights you want to assign
to
> it.
> RS provides very limited default "trust" of Custom Assemblies, you'll need
> to define specific additions to this to allow access to the database.
> Btw: Although it can be done, it's a little unusual to access the database
> from a Custom Assembly - I normally see it done as an extension like a
data
> procesing extension.
> HTH
> - peteZ
>
> "Carlos López." <CarlosLpez@.discussions.microsoft.com> wrote in message
> news:A591ABD5-0838-4B99-88A3-43FBBE27FD49@.microsoft.com...
> > Hi Group!
> >
> > I've a big problem with MS Reporting Services, i try to access an oracle
> > database from a custom assembly, in desing view all work nice, but in
> > production environment, the call to the class fail!.
> > What i can do to correct this problem?
> >
> > I added the dll file to de bin folder or reportserver and report
designer,
> > but don't work.
> >
> > Really I need help.
> >
> > Thanks for the help
> >
>

No comments:

Post a Comment