Showing posts with label reading. Show all posts
Showing posts with label reading. Show all posts

Thursday, March 22, 2012

Custom Task and Reading Package Configuration

Hello All,

I have searched on this forum for a similar question but couldn't find it so I apologize if this has been asked. If so, I'd greatly appreciate a link to the question. I have created a custom task and am trying to read an xml package configuration file within my custom task. To be more specific, I have added an ADO.Net Connection to my database onto the package and have generated the appropriate tags within my package's configuration xml file. I'm not seeing the classes I should use to access the configuration file of the package I've created. Does anybody have any ideas how I can accomplish this or a link to a document that might cover the material? Thanks!

Jay_G

Jay,

First, let's be sure that what you're trying to do is what you really want to do.

Why do you want to read the configuration? Are you trying to do something with the configuration or do you simply want your custom task to be configured?

|||

Hello Kirk,

Thank you for responding. My custom task will, at times, need to read from a database and I figured the standard database connection string parameters would all be within the configuration file. I initially thought that I would need to use a package connection but the original intent of this custom task is be as easy to use and seemless as possible (meaning drop the task on the designer, set a few properties and be done). The custom task will be used over and over again within many packages. We didn't want to make all of our package developers have to configure a connection for this task but maybe this approach doesn't make sense. Does that make sense or should I be doing it a different way? I'm very new to SSIS and very much open to suggestions. Let me know if you need more clarification. Thanks again.

Jay_G

Sunday, March 11, 2012

custom path for data files

Hi,
I am about to install sql 2005 in a clustered scenario. I am reading the
installation notes and it says :
On the Cluster Group Selection page, select the group that contains the
drive you want to use for SQL Server from the Available Cluster Groups. The
selected cluster group is where the SQL Server virtual SQL Server resources
are placed. If you select the group containing the cluster quorum resource, a
warning is displayed recommending you do not install to the cluster quorum
resource. You can also specify a custom path for data files in the Data Files
field. To proceed, click Next.
My question is that I have two nodes both sharing D, E & QDrive if I select
the custom path option at this point in the installaion will I be able to
select D for databases and E for logs?
http://msdn2.microsoft.com/en-us/library/ms179530.aspx
Yes. You can add E: to the cluster group, make SQL dependent on it, and use
it for data or logs.
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:99A9574F-1DDF-4741-8676-FC6EB36DFAFB@.microsoft.com...
> Hi,
> I am about to install sql 2005 in a clustered scenario. I am reading the
> installation notes and it says :
> On the Cluster Group Selection page, select the group that contains the
> drive you want to use for SQL Server from the Available Cluster Groups.
> The
> selected cluster group is where the SQL Server virtual SQL Server
> resources
> are placed. If you select the group containing the cluster quorum
> resource, a
> warning is displayed recommending you do not install to the cluster quorum
> resource. You can also specify a custom path for data files in the Data
> Files
> field. To proceed, click Next.
> My question is that I have two nodes both sharing D, E & QDrive if I
> select
> the custom path option at this point in the installaion will I be able to
> select D for databases and E for logs?
>
> http://msdn2.microsoft.com/en-us/library/ms179530.aspx
|||Hi Geoff,
Thanks for this but I'm new at this and a little confused.
I have:
cluster group containing Q
group 0 containing D Drive (I would like the data files here)
group 1 containing E Drive (I would like the log files here)
When I went through the setup I was expecting to have the choice of
splitting the files but could only chose one cluster group so I chose cluster
group 0.
Now when I opened management studio to change the logs location I can only
see D, adding the E Drive to group 0 also does not allow me to see E drive
from management studio.
What am I missing?
thanks in advance
I have now installed sql and at the point when asked
"Geoff N. Hiten" wrote:

> Yes. You can add E: to the cluster group, make SQL dependent on it, and use
> it for data or logs.
> --
> Geoff N. Hiten
> Senior SQL Infrastructure Consultant
> Microsoft SQL Server MVP
>
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:99A9574F-1DDF-4741-8676-FC6EB36DFAFB@.microsoft.com...
>
|||You are missing dependency.
Using the Cluster admin tool, take the SQL Service offline but leave the
rest of the group online. Right-click the SQL Service... Properties.
Advanced tab. Add the new disk as an item the SQL Service is dependent on.
Bring SQL back online.
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:1AB63836-C0CF-4228-A1DC-9D8F28AB63FA@.microsoft.com...[vbcol=seagreen]
> Hi Geoff,
> Thanks for this but I'm new at this and a little confused.
> I have:
> cluster group containing Q
> group 0 containing D Drive (I would like the data files here)
> group 1 containing E Drive (I would like the log files here)
> When I went through the setup I was expecting to have the choice of
> splitting the files but could only chose one cluster group so I chose
> cluster
> group 0.
> Now when I opened management studio to change the logs location I can only
> see D, adding the E Drive to group 0 also does not allow me to see E drive
> from management studio.
> What am I missing?
> thanks in advance
>
> I have now installed sql and at the point when asked
> "Geoff N. Hiten" wrote:

Friday, February 24, 2012

Custom Code

I have been reading a little about custom code - Where do I type this code at in the report? Does anyone have a sample report or info they could pass along? Sorry about the dumb question , but i am a newbie and I am not so bright...you click on Report - Properties and click on Code tab. there you can write your vb.net functions..
sample CC :

Public Shared Function RetCardHolderName(lastname as string, middle as string,firstname as string) as String
If ( firstname is system.dbnull.value OR len(trim(firstname))=0 ) Then
return ( trim(lastname))
else
if ( middle is system.dbnull.value OR len(trim(middle))=0 ) Then
return (trim(firstname) & " " & trim(lastname))
else
return (trim(firstname) & " " & trim(middle) & " " & trim(lastname) )
end if
end if
End Function

I wrote this CC to return the first, middle and last names concatenated as one string.

from the report I pass the parameters as :
in the Expression window for the field :

=Code.RetCardHolderName(Fields!LAST_NAME.Value, Fields!MID_NAME.Value, Fields!FIRST_NAME.Value)
|||Thank You! The example was also a big help!

Sunday, February 19, 2012

Custom Assembly Reading from Registry

Can anyone point me to an example of a MS SRS 2005 custom assembly reading
from the registry? We have had this issue on/off for several months, and we
are at the breaking point. The assembly has to access our database and we
want to store the connection information in the registry for shared use with
other components.
The network admins assure us that all users have read access to the
registry. It appears that we have granted our assembly fulltrust via
entries in the rs srs policy file. For a while were were using MS SRS 2000
and a temp work-around was to disable Code Access Security (CAS). We have
since upgraded to MS SRS 2005 and that work-around does not appear to work
anymore as our admin cannot seem to turn-off CAS (not that that is the
solution we want). Our code appears to fail when we assert read permission
on our registry key.
We're no longer in a trial-and-error approach to solving this. We've spent
way too long on something that, in our opinion, should be fairly simple. A
working example of a custom assembly, including policy file entiries, that
reads string values from the registry would be very welcome.
Any help would be appreciated.
Thanks,
ChrisHi Chris,
Thank you for your posting!
My understanding of this issue is: You want use custom assembly to access
the Registry in Reporting Services 2005. If I misunderstood your concern,
please feel free to let me know.
Based on my scope, you could turn-off CAS temporarily and try to run your
assembly.
Remember, in .NET 2005, you could only turn off CAS by using the Caspol.exe
temporarily. If you press <Enter> then you will restore the setting and
turn on the CAS.
If you could access the registry when you turn-off the CAS, then please
let me know what change have you done on your policy config file and post
the changes here.
If you still can not access the registry when you turn-off the CAS, we need
to start the Regmon to monitor the registry. You could download this tool
from the following site:
http://www.sysinternals.com/Utilities/Regmon.html.
Please let me know the result and so that I can provide further assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Chris ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||I apologize for the long delay. Other matters have taken precedence, but I
hope to return to this next week. I will try disabling CAS again to see if
my policy entry is the culprit and I'll let you know the results.
Thanks,
Chris
"Wei Lu [MSFT]" <weilu@.online.microsoft.com> wrote in message
news:tcrT04ApGHA.4612@.TK2MSFTNGXA01.phx.gbl...
> Hi Chris ,
> How is everything going? Please feel free to let me know if you need any
> assistance.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Hi Chris,
Thanks for your followup. Since Wei is OOF due to some urgent business,
I'll continue to help you on this issue. And sure, please feel free to
manage your first priority work and just let me know when you get any
progress or need any further assistance. We'll hold this thread and closely
monitoring it.
Looking forward to your update!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
========================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||This is a multi-part message in MIME format.
--=_NextPart_000_000C_01C6AA84.480797E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I executed my report that has a custom assemby that reads from the =registery. As previously described, it failed with the following error:
Request for the permission of type ='System.Security.Permissions.RegistryPermission, mscorlib, =Version=3D2.0.0.0, Culture=3Dneutral, PublicKeyToken=3Db77a5c561934e089' =failed
As directed I disabled code access security (caspol -s off). Prior to =pressing <enter>, I re-executed the report and still received the same =error. I both refreshed the report, and also closed the browser and =re-logged in to execute the report. No change.
My rssrvpolicy.config entry for my custom assembly is below.
<CodeGroup class=3D"UnionCodeGroup"
version=3D"1"
PermissionSetName=3D"FullTrust"
Name=3D"cgBBSDataFormatter"
Description=3D"">
<IMembershipCondition class=3D"UrlMembershipCondition"
version=3D"1"
Url=3D"file://D:/Program Files/Microsoft SQL =Server/MSSQL.3/Reporting =Services/ReportServer/bin/BBSDataFormatter.dll"/>
</CodeGroup>
He is nested within the following codegroup entry:
<CodeGroup class=3D"FirstMatchCodeGroup" version=3D"1" PermissionSetName=3D"Execution"
Description=3D"This code group grants MyComputer code Execution =permission. ">
<IMembershipCondition class=3D"ZoneMembershipCondition"
version=3D"1"
Zone=3D"MyComputer" />
Any help would be greatly appreciated.
- Chris
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message =news:eedfRYYqGHA.4188@.TK2MSFTNGXA01.phx.gbl...
> Hi Chris,
> > Thanks for your followup. Since Wei is OOF due to some urgent =business, > I'll continue to help you on this issue. And sure, please feel free to =
> manage your first priority work and just let me know when you get any > progress or need any further assistance. We'll hold this thread and =closely > monitoring it.
> > Looking forward to your update!
> > Sincerely,
> > Steven Cheng
> > Microsoft MSDN Online Support Lead
> > ==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > This posting is provided "AS IS" with no warranties, and confers no =rights.
>
--=_NextPart_000_000C_01C6AA84.480797E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

I executed my report that has a custom =assemby that reads from the registery. As previously described, it failed with =the following error:
Request for the permission of =type 'System.Security.Permissions.RegistryPermission, mscorlib, =Version=3D2.0.0.0, Culture=3Dneutral, PublicKeyToken=3Db77a5c561934e089' failed
As directed I disabled code access =security (caspol -s off). Prior to pressing , I re-executed the report =and still received the same error. I both refreshed the report, and =also closed the browser and re-logged in to execute the report. No change.
My rssrvpolicy.config entry for my =custom assembly is below.
 =;
He is nested within the following =codegroup entry:

Any help would be greatly =appreciated.
- Chris
"Steven Cheng[MSFT]" wrote in message news:eedfRYYqGHA.4188@.TK2MSFTNGXA01.phx.gbl...> =Hi Chris,> > Thanks for your followup. Since Wei is OOF due to some urgent =business, > I'll continue to help you on this issue. And sure, please feel =free to > manage your first priority work and just let me know when you =get any > progress or need any further assistance. We'll hold this thread =and closely > monitoring it.> > Looking forward to your =update!> > Sincerely,> > Steven =Cheng> > Microsoft MSDN Online Support Lead> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> => This posting is provided "AS IS" with no warranties, and confers no rights.>

--=_NextPart_000_000C_01C6AA84.480797E0--|||Hi Chris,
Thanks a lot for your prompt response and the further detailed information.
After reading the security policy file you posted, I found that you use the
"UnionCodeGroup" for your custom codegroup type, I think it would be
better to use the "FirstMatchCodeGroup" which will exclude any other
matched CodeGroup and you need to put it as before other groups as possible
so that it will be evaluated and matched first in the policy file. The
custom codegroup element's content is ok from my view.
In addition, I've performed some tests on my local environment and noticed
some other problems here:
In our custom assembly's code there are two things we need to take care:
1. Make sure that our assembly is marked as
"AllowPartiallyTrustedCallersAttribute", such as:
[assembly:AllowPartiallyTrustedCallers]
2. Before we calling the registry code(or access any restricted resource),
we need to construct the certain Permission instance and Assert it. e.g:
public class Class1
{
public static string Test()
{
RegistryPermission perm = new
RegistryPermission(RegistryPermissionAccess.Read,
@."HKEY_LOCAL_MACHINE\SOFTWARE");
perm.Assert();
RegistryKey regkey =Registry.LocalMachine.OpenSubKey("Software", false);
int i = regkey.SubKeyCount;
return "LocalMachine_Software_SubKeyCount: " + i;
}
}
Here is a web article which has demonstrate a complete sample(it is
performing file access in custom assembly) and it has mentioned many things
we need to take care when developing and deploying custom assemby.
http://www.c-sharpcorner.com/Code/2005/June/CustomAssemblyinRS.asp
BTW, here is my custom codegroup section in the policy file:
===============<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyCustomAssemblyCodeGroup"
Description="A special code group for my custom assembly.">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting
Services\ReportServer\bin\CustomAssembly.dll"/>
</CodeGroup>
===================
Further more, if you still meet problem on this and if you feel convenient,
you can provide me a copy or code of your simplified custom assembly(which
can reproduce the problem behavior) so that I can do some further test on
my side.
Hope the above info helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Chris,
Have you got any further process on this issue, or does the information in
my last reply also helps on this issue?
Curerntly we're still closely monitoring this issue, if you still have any
questions or if there is anything we can help, please feel free to post
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Steven,
Modifying the policy file as suggested did the trick. We had previously
implemented the other two suggestions when we first ran into this problem.
Thank you for your help.
Regards,
Chris
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:6UHfrWNrGHA.4272@.TK2MSFTNGXA01.phx.gbl...
> Hello Chris,
> Have you got any further process on this issue, or does the information in
> my last reply also helps on this issue?
> Curerntly we're still closely monitoring this issue, if you still have any
> questions or if there is anything we can help, please feel free to post
> here.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||Thanks for your followup Chris,
Glad to hear the good news.
Have a good day!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Custom assembly on report.

I am using an external assembly on one of my report. This assembly simply
does some data reading, does some calculation, and updating a table, and is
working fine if called directly from an aspx page. However, if I call the
assembly from my report it fails with an error below:
Reporting Services Error
----
Failed to load expression host assembly. Details: Request for the permission
of type System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
(rsProcessingError)
----
I have given my assembly FullTrust permission in rsrvrpolicy.config.
System.Data.dll was also given FullTrust permission, but this did not solve
the problem.
FYI, my assembly was not written as a Reporting Services custom data
extension. I did not think about implementing one since the assembly itself
does not supply the data to my report. My report is still using a shared
data source defined in the report project.
Do I need to rewrite my assembly to a Reporting Services data extension
(using the data interfaces) for it to work with my reports?
Any help would be much appreciated. TIA.It sounds like you did not explicitly assert permissions to open a database
connection. Unless you assert (!) the permission explicitly in the custom
assembly code, it will fail with a security exception.
Example for opening a connection to a SQL Server:
...
SqlClientPermission permission = new
SqlClientPermission(PermissionState.Unrestricted);
try
{
permission.Assert(); // Assert security permission!
SqlConnection con = new SqlConnection("...");
con.Open();
...
}
BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
because the SqlClient is enabled for partial trust scenarios. Unlike the
OracleClient - in case you are interested in the details about the
differences:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"TechnoSpyke" <technospyke@.yahoo.com> wrote in message
news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> I am using an external assembly on one of my report. This assembly simply
> does some data reading, does some calculation, and updating a table, and
is
> working fine if called directly from an aspx page. However, if I call the
> assembly from my report it fails with an error below:
> Reporting Services Error
> ----
--
> Failed to load expression host assembly. Details: Request for the
permission
> of type System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> (rsProcessingError)
> ----
--
> I have given my assembly FullTrust permission in rsrvrpolicy.config.
> System.Data.dll was also given FullTrust permission, but this did not
solve
> the problem.
> FYI, my assembly was not written as a Reporting Services custom data
> extension. I did not think about implementing one since the assembly
itself
> does not supply the data to my report. My report is still using a shared
> data source defined in the report project.
> Do I need to rewrite my assembly to a Reporting Services data extension
> (using the data interfaces) for it to work with my reports?
> Any help would be much appreciated. TIA.
>|||Hi Robert,
I have a custom assembly with 2 functions one using SqlClient for dataaccess
as below which is working fine with the assert, but I also have one using
System.DirectoryServices which i am trying to use with:
System.DirectoryServices.DirectoryServicesPermission pDir = new
DirectoryServicesPermission(System.Security.Permissions.PermissionState.Unrestricted);
pDir.Assert();
Unfortunately i am getting the following error:
"Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed."
Any ideas?
I cant seem to solve this one and there doesnt seem to be any help anywhere.
Thanks,
Flon Mackenzie
"Robert Bruckner [MSFT]" wrote:
> It sounds like you did not explicitly assert permissions to open a database
> connection. Unless you assert (!) the permission explicitly in the custom
> assembly code, it will fail with a security exception.
> Example for opening a connection to a SQL Server:
> ...
> SqlClientPermission permission = new
> SqlClientPermission(PermissionState.Unrestricted);
> try
> {
> permission.Assert(); // Assert security permission!
> SqlConnection con = new SqlConnection("...");
> con.Open();
> ...
> }
> BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
> because the SqlClient is enabled for partial trust scenarios. Unlike the
> OracleClient - in case you are interested in the details about the
> differences:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "TechnoSpyke" <technospyke@.yahoo.com> wrote in message
> news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> > I am using an external assembly on one of my report. This assembly simply
> > does some data reading, does some calculation, and updating a table, and
> is
> > working fine if called directly from an aspx page. However, if I call the
> > assembly from my report it fails with an error below:
> >
> > Reporting Services Error
> > ----
> --
> >
> > Failed to load expression host assembly. Details: Request for the
> permission
> > of type System.Data.SqlClient.SqlClientPermission, System.Data,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> > (rsProcessingError)
> >
> > ----
> --
> >
> > I have given my assembly FullTrust permission in rsrvrpolicy.config.
> > System.Data.dll was also given FullTrust permission, but this did not
> solve
> > the problem.
> >
> > FYI, my assembly was not written as a Reporting Services custom data
> > extension. I did not think about implementing one since the assembly
> itself
> > does not supply the data to my report. My report is still using a shared
> > data source defined in the report project.
> >
> > Do I need to rewrite my assembly to a Reporting Services data extension
> > (using the data interfaces) for it to work with my reports?
> >
> > Any help would be much appreciated. TIA.
> >
> >
>
>