Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - SQL Server 2005 MSDB Access

Reply
 
Old 04-15-2008   #1 (permalink)
cappjr


 
 

SQL Server 2005 MSDB Access

On my SQL Server, I have a stored proc called 'sp_exec_job' that
simply starts a job:

EXEC [msdb].[dbo].sp_start.job @JOB_NAME

When I run this from Management Studio, it works fine. Yea.

But, when I try to execute sp_exec_job from my .NET (C#) code (on the
same server as the SQL DB), I get the following error:

System.Data.SqlClient.SqlException: Could not find server 'msdb' in
sysservers. Execute sp_addlinkedserver to add the server to
sysservers.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)

Any ideas?

My System SpecsSystem Spec
Old 04-15-2008   #2 (permalink)
cappjr


 
 

Re: SQL Server 2005 MSDB Access

Sorry, the above message is not correct (I pasted the wrong message).
This is the error I am getting...

System.Data.SqlClient.SqlException: EXECUTE permission denied on
object 'sp_start_job', database 'msdb', schema 'dbo'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
My System SpecsSystem Spec
Old 04-15-2008   #3 (permalink)
cappjr


 
 

Re: SQL Server 2005 MSDB Access

On Apr 15, 10:20*am, cap...@xxxxxx wrote:
Quote:

> Sorry, the above message is not correct (I pasted the wrong message).
> This is the error I am getting...
>
> System.Data.SqlClient.SqlException: EXECUTE permission denied on
> object 'sp_start_job', database 'msdb', schema 'dbo'.
> at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
> Boolean breakConnection)
> at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
> exception, Boolean breakConnection)
> at
> System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObje*ct
> stateObj)
> at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
> SqlCommand cmdHandler, SqlDataReader dataStream,
> BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
> stateObj)
Never mind, i just gave my SQL user owner permissions on the msdb
database. Duh. Sorry to waste anyone's time.
My System SpecsSystem Spec
Old 04-15-2008   #4 (permalink)
Norman Yuan


 
 

Re: SQL Server 2005 MSDB Access

Also, do not name your own stored procedure like "sp_xxxxxxx", which is used
for system stored procedures.

<cappjr@xxxxxx> wrote in message
news:ae94a163-9b99-4c51-af40-68ecc63c9b31@xxxxxx
On Apr 15, 10:20 am, cap...@xxxxxx wrote:
Quote:

> Sorry, the above message is not correct (I pasted the wrong message).
> This is the error I am getting...
>
> System.Data.SqlClient.SqlException: EXECUTE permission denied on
> object 'sp_start_job', database 'msdb', schema 'dbo'.
> at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
> Boolean breakConnection)
> at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
> exception, Boolean breakConnection)
> at
> System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObje*ct
> stateObj)
> at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
> SqlCommand cmdHandler, SqlDataReader dataStream,
> BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
> stateObj)
Never mind, i just gave my SQL user owner permissions on the msdb
database. Duh. Sorry to waste anyone's time.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Server 2008 hosted on Virtual Server 2005 R2 very slow Virtual Server
Virtual Server 2005 r2 - moving VPC server to server - blue screen Virtual Server
Virtual Server 2005 w/ 2008 Server Virtual Server
Windows 2000 Server From Virtual Server 2005 to Hyper-V Virtual Server
Installing Visual Studio 2005 Std Ed, SQL Server 2005 Expr./Compac Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46