Showing posts with label activate. Show all posts
Showing posts with label activate. Show all posts

Sunday, March 11, 2012

Activation not working

Hi There

Everything works 100% until i activate my sp.

I specify to execute as 'dbo' in the alter queue statement. I also define the activated sp to execute as 'dbo'.

But i keep getting permission errors from my activated sp. i have tried to excute as 'sa' , i have even tried to write a job that excutes to stored procedure but it also get weird errors. Bottom line if i exceute the sp in management studio logged in as sa it works , but thorugh activation or a job nothing works, as 'dbo' or 'sa'.

?

Thanx

Hi there.

It seems the statement in my sp that has a permission problem is the get conversation group sattement.

So my activation on the queue does not work when i stipulate execute as 'dbo' or OWNER. I cannot assign execute as 'sa' i get the following error "The server principal "sa" is not able to access the database "OLTP1PRO" under the current security context". I have tried not to stipulate the execute as so taht it defaults to a sysadmin.

But i always get this error:

The user does not have permission to perform this action.

So i tried the following.

CREATE LOGIN QueueReader with password = 'T#ST123'

CREATE USER QueueReader for login QueueReader

grant receive on [ewx.co.za/Queue/ewx_sb_central_queue] to QueueReader

grant execute on dbo.CENTRAL_Queue_Processor to QueueReader

And chanegd the execute as to QueueReader, but is till get the same error.

I dunno what else to try, no matter hwat i do i cannot execute the get conversation group statement ?

Please help ?

|||anyone?|||

What error do you get if you manually invoke the procedure, from Management Studio, under the QueueReader user context?

executeasuser'QueueReader';

go

exec dbo.CENTRAL_Queue_Processor;

go

revert;

go

|||

Hi Remus

I get the same error as before. The user does not have permission to perform this action. Error number 297.

I have done more investigation, judging by the erro line number line it seems that the QueueReader user cannot read from

sys.dm_broker_activated_tasks.

However i am expecting these errors, the activated stored procedure has many inserts etc. SO basically i want the activated sp to run as dbo, i do not want to have to setup alot of permission for the user.

My biggest question is why does EXECUTE as 'dbo' or OWNER not work ? How can i get permission errors when it executes as dbo ?

So i make QueueReader dbo of the database and i still get the user doesnot have permission error, so it seems only sysadmin can select from the sys. views, however i am still stumped , since the dbo of the database is a sysadmin. If i login as the user who is the dbo i can execute it. But if i say execute as dbo i get the permission error, i am totally stumped ?

Thanx

|||

Ok so it seems that if i reference sis.dm views in my activated sp i have to make the execute as user a sysadmin, or grant that user select on the sys.dm views , is this correct?

However i am still interested to know why execute as dbo does nto work when the dbo is also a sysadmin?

Thanx Remus you rfeedabck will be greatly appreciated.

|||

Hi Remus

Lastly, it also mentions in Roger Wolters book that if you do not stipulate execute as for your activated sp it will execute in the backgrouond as a sysadmin. However if i do not stipulate execute as i still get the permission error ? So not sure what is happening there?

Thanx

|||

Execute as user is restricted to database context. sysadmin is a server context concept. An untrusted database cannot extend the context to the server. This topic is covered in my blog in these posts: http://blogs.msdn.com/remusrusanu/archive/2006/01/12/512085.aspx, http://blogs.msdn.com/remusrusanu/archive/2006/03/01/541882.aspx and http://blogs.msdn.com/remusrusanu/archive/2006/03/07/545508.aspx

The simplest solution is to mark the database as trustworthy.

HTH,
~ Remus

|||

Thanx Remus

The links were worth reading and the trustworthy worked.

Just as a matter of interrest , what is the best practice in a prouction environment when the activation proc requires sys.dm views. Do you make the queue reader user a sysadmin (must be a bad idea), or make the dbo of the database a sysadmin, or simply grant the user permission to the sys.dm views (probably best) ? In gerneral when the actvation proc must use these views what would you reccomend ?

|||

The safest option is code signing (as in the exaple in my link). Getting code siging righ is really hard, so if you can get away with trustworthy bit, is much more easier. sysadmin is not a requirement, the appropiate priviledges needed to be granted are AUTHENTICATE SERVER to the database dbo and VIEW SERVER STATE to the execute as user.

HTH,
~ Remus

|||

HI Remus

Great thanx , i thnk i will stick to trustworthy and the permission you specified, thanx very much

Activation not working

Hi There

Everything works 100% until i activate my sp.

I specify to execute as 'dbo' in the alter queue statement. I also define the activated sp to execute as 'dbo'.

But i keep getting permission errors from my activated sp. i have tried to excute as 'sa' , i have even tried to write a job that excutes to stored procedure but it also get weird errors. Bottom line if i exceute the sp in management studio logged in as sa it works , but thorugh activation or a job nothing works, as 'dbo' or 'sa'.

?

Thanx

Hi there.

It seems the statement in my sp that has a permission problem is the get conversation group sattement.

So my activation on the queue does not work when i stipulate execute as 'dbo' or OWNER. I cannot assign execute as 'sa' i get the following error "The server principal "sa" is not able to access the database "OLTP1PRO" under the current security context". I have tried not to stipulate the execute as so taht it defaults to a sysadmin.

But i always get this error:

The user does not have permission to perform this action.

So i tried the following.

CREATE LOGIN QueueReader with password = 'T#ST123'

CREATE USER QueueReader for login QueueReader

grant receive on [ewx.co.za/Queue/ewx_sb_central_queue] to QueueReader

grant execute on dbo.CENTRAL_Queue_Processor to QueueReader

And chanegd the execute as to QueueReader, but is till get the same error.

I dunno what else to try, no matter hwat i do i cannot execute the get conversation group statement ?

Please help ?

|||anyone?|||

What error do you get if you manually invoke the procedure, from Management Studio, under the QueueReader user context?

execute as user 'QueueReader';

go

exec dbo.CENTRAL_Queue_Processor;

go

revert;

go

|||

Hi Remus

I get the same error as before. The user does not have permission to perform this action. Error number 297.

I have done more investigation, judging by the erro line number line it seems that the QueueReader user cannot read from

sys.dm_broker_activated_tasks.

However i am expecting these errors, the activated stored procedure has many inserts etc. SO basically i want the activated sp to run as dbo, i do not want to have to setup alot of permission for the user.

My biggest question is why does EXECUTE as 'dbo' or OWNER not work ? How can i get permission errors when it executes as dbo ?

So i make QueueReader dbo of the database and i still get the user doesnot have permission error, so it seems only sysadmin can select from the sys. views, however i am still stumped , since the dbo of the database is a sysadmin. If i login as the user who is the dbo i can execute it. But if i say execute as dbo i get the permission error, i am totally stumped ?

Thanx

|||

Ok so it seems that if i reference sis.dm views in my activated sp i have to make the execute as user a sysadmin, or grant that user select on the sys.dm views , is this correct?

However i am still interested to know why execute as dbo does nto work when the dbo is also a sysadmin?

Thanx Remus you rfeedabck will be greatly appreciated.

|||

Hi Remus

Lastly, it also mentions in Roger Wolters book that if you do not stipulate execute as for your activated sp it will execute in the backgrouond as a sysadmin. However if i do not stipulate execute as i still get the permission error ? So not sure what is happening there?

Thanx

|||

Execute as user is restricted to database context. sysadmin is a server context concept. An untrusted database cannot extend the context to the server. This topic is covered in my blog in these posts: http://blogs.msdn.com/remusrusanu/archive/2006/01/12/512085.aspx, http://blogs.msdn.com/remusrusanu/archive/2006/03/01/541882.aspx and http://blogs.msdn.com/remusrusanu/archive/2006/03/07/545508.aspx

The simplest solution is to mark the database as trustworthy.

HTH,
~ Remus

|||

Thanx Remus

The links were worth reading and the trustworthy worked.

Just as a matter of interrest , what is the best practice in a prouction environment when the activation proc requires sys.dm views. Do you make the queue reader user a sysadmin (must be a bad idea), or make the dbo of the database a sysadmin, or simply grant the user permission to the sys.dm views (probably best) ? In gerneral when the actvation proc must use these views what would you reccomend ?

|||

The safest option is code signing (as in the exaple in my link). Getting code siging righ is really hard, so if you can get away with trustworthy bit, is much more easier. sysadmin is not a requirement, the appropiate priviledges needed to be granted are AUTHENTICATE SERVER to the database dbo and VIEW SERVER STATE to the execute as user.

HTH,
~ Remus

|||

HI Remus

Great thanx , i thnk i will stick to trustworthy and the permission you specified, thanx very much

Thursday, March 8, 2012

activate or execute a ssis package from sharepoint document library

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

muhammad naeem wrote:

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

Michael Entin has a blog post that will help you here: http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

There are a number of ways of executing SSIS packages, you jest need to see which works best for your scenario.

-Jamie

|||

Hi Muhammad,

I have a similar requirement where on document upload in Sharepoint 2003 , I have to execute a SSIS package which will validate and store data in Database. Can you also tell me how you did it and whether it is working.

Regards,

Swati

|||

Hi swati

ya i can give you a idea that how am i done it

my issue is related with MOSS 2007 not on 2003.i start my work on SharePoint after the 2007 release so don’t know about that how can you do it on 2003 but here is the procedure which i use in moss 2007

I first create a work flow which have InfoPath form for configuration. in which i take the sp name the take two parameters one the url of the uploaded document and the other is the SSIS package name.

In this work flow I execute that sp by giving the ssis pacage name and the current document. In that sp a execute the dtsexe.exe(detail in linked below) to activate ssis package.

Then I attach this work flow with document library.

I got help from these two posts. You can too find more detail from them.

Michael Entin blog post

http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

and Jeff Modzel belogs

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp

if you need then I can give you code too.

|||

Hi Muhammad,

Thanks for your quick response. What is sp, if it is stored procedure, then how to take stored proc name in Infopath forms. Can you please send me the code, including the infopath form at pashmina_15@.yahoo.com

I need to learn how to create workflow and how to attach workflow with document library.

Also does this solution helps to solve the purpose, i.e. Whenever a new document is uploaded / updated to document library it will trigger SSIS package?

Thanks once again for your quick help.

Regards,

Swati

activate or execute a ssis package from sharepoint document library

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

muhammad naeem wrote:

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

Michael Entin has a blog post that will help you here: http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

There are a number of ways of executing SSIS packages, you jest need to see which works best for your scenario.

-Jamie

|||

Hi Muhammad,

I have a similar requirement where on document upload in Sharepoint 2003 , I have to execute a SSIS package which will validate and store data in Database. Can you also tell me how you did it and whether it is working.

Regards,

Swati

|||

Hi swati

ya i can give you a idea that how am i done it

my issue is related with MOSS 2007 not on 2003.i start my work on SharePoint after the 2007 release so don’t know about that how can you do it on 2003 but here is the procedure which i use in moss 2007

I first create a work flow which have InfoPath form for configuration. in which i take the sp name the take two parameters one the url of the uploaded document and the other is the SSIS package name.

In this work flow I execute that sp by giving the ssis pacage name and the current document. In that sp a execute the dtsexe.exe(detail in linked below) to activate ssis package.

Then I attach this work flow with document library.

I got help from these two posts. You can too find more detail from them.

Michael Entin blog post

http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

and Jeff Modzel belogs

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp

if you need then I can give you code too.

|||

Hi Muhammad,

Thanks for your quick response. What is sp, if it is stored procedure, then how to take stored proc name in Infopath forms. Can you please send me the code, including the infopath form at pashmina_15@.yahoo.com

I need to learn how to create workflow and how to attach workflow with document library.

Also does this solution helps to solve the purpose, i.e. Whenever a new document is uploaded / updated to document library it will trigger SSIS package?

Thanks once again for your quick help.

Regards,

Swati

activate

Hi
How can i activate mssql2000.
Thanks
If you are talking about upgrading to retail version from an evaluation
edition of SQL Server, try:
http://support.microsoft.com/default...b;en-us;281574
If not, please clarify.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
Hi
How can i activate mssql2000.
Thanks
|||SQL Server does not require activation. Perhaps you could elaborate.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
> Hi
> How can i activate mssql2000.
> --
> Thanks
|||Do you mean how do you *start* SQL Server? Use the Service Manager (in
the SQL Server program group) to do that, or start the service from the
Windows Services applet.
David Portas
SQL Server MVP

activate

Hi
How can i activate mssql2000.
--
ThanksIf you are talking about upgrading to retail version from an evaluation
edition of SQL Server, try:
http://support.microsoft.com/default.aspx?scid=kb;en-us;281574
If not, please clarify.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
Hi
How can i activate mssql2000.
--
Thanks|||SQL Server does not require activation. Perhaps you could elaborate.
--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
> Hi
> How can i activate mssql2000.
> --
> Thanks|||Do you mean how do you *start* SQL Server? Use the Service Manager (in
the SQL Server program group) to do that, or start the service from the
Windows Services applet.
--
David Portas
SQL Server MVP
--

activate

Hi
How can i activate mssql2000.
--
ThanksIf you are talking about upgrading to retail version from an evaluation
edition of SQL Server, try:
http://support.microsoft.com/defaul...kb;en-us;281574
If not, please clarify.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
Hi
How can i activate mssql2000.
--
Thanks|||SQL Server does not require activation. Perhaps you could elaborate.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"shif" <ns_0001@.hotmail.com> wrote in message
news:3B53D09A-1BE0-486C-A33D-C34E123415AE@.microsoft.com...
> Hi
> How can i activate mssql2000.
> --
> Thanks|||Do you mean how do you *start* SQL Server? Use the Service Manager (in
the SQL Server program group) to do that, or start the service from the
Windows Services applet.
David Portas
SQL Server MVP
--

Friday, February 24, 2012

Accessing web.config from stored procedure

I want to access a key from appSettings section of web.config.

I have the number of days allowed for a user to activate his/her account as a key in appSettings.

I have a maintenance procedure to delete all accounts that are not activated before that many days.

In this context, i have to access web.config from stored procedure. The procedure will be scheduled as a JOB in sql server.

Thanks.

Hi,

Are you having problem to access the appSettings secion in the web.config file? If so, you can use ConfigurationManager.AppSettings property to achieve that.

Here is a link for your reference.

http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager.appsettings.aspx

If your stored procedure, that is running as a job, is trying to access the value, you might need to save the value to a database table or somewhere. Then your stored procedure can get that. It cannot get the web.config value directly.

|||

Thanks Kevin.

My requirement is to access appSettings from a stored procedure of SQL Server. So that whenever I change web.config, the procedure must

automatically access the new value.

Is there any way to access any XML file from a stored procedure. May be that could solve my problem. I heard about XML support in SQL Server. What does that do?

Thanks again.

Srikanth.

|||

Hi Srikanth,

Teh SQL Server 2005 support for Xml is for Xml column type and Xml manipulation. It stays in the database level, but not for reading an external file.

A traditional stored procedure does not read from a file. In this case, I think you have 2 options.

1. Make your app write that appSetting to a certain place in the database timely. The stored procedure can get that as a parameter.

2. Write a CLR stored procedure. Since SQL Server 2005 supports running .NET code, you can write a method and put it in assembly. Each time, you can have the assembly read from certain file, parse the xml and get the setting value.

There are many articles talking about how to create a CLR stored procedure. Here are some of them.

http://msdn2.microsoft.com/en-us/library/ms131094.aspx
http://msdn2.microsoft.com/en-us/library/5czye81z(VS.80).aspx