Solved

SQL Server Agent TSQL Query using sp_OACreate. What NT security does the dbo SQL user have?

Posted on 2004-04-29
1
639 Views
Last Modified: 2011-08-18
I have a TSQL script that calls a COM object from it. The running user (SQL Agent scheduler) runs it with a dbo login from SQL so who's security does it connect to the COM object as? The login process of SQL Agent, the login process of SQL server or something else?

DECLARE @oQBXMLrp int
DECLARE @iHR int
DECLARE @iCnt int
DECLARE @sSource varchar(255)
DECLARE @sDesc varchar(255)
DECLARE @sObjectName varchar(255)

SET @iCnt = 1
SELECT "Current User: " = CURRENT_USER, " Time: " = CONVERT(char(30), CURRENT_TIMESTAMP)
WHILE @iCnt < 6 BEGIN
    SET @sObjectName = CASE @iCnt
        WHEN 1 THEN 'QBXMLRPEQODBCInteractive.RequestProcessor'
        WHEN 2 THEN 'QBXMLRP.RequestProcessor'
        WHEN 3 THEN 'QBXMLRP2EQODBCInteractive.RequestProcessor'
        WHEN 4 THEN 'QBXMLRP2.RequestProcessor'
        ELSE 'Xerces.DOMDocument'
    END
    EXEC @iHR = sp_OACreate @sObjectName, @oQBXMLrp OUT
    IF @iHR <> 0 BEGIN
        EXEC sp_OAGetErrorInfo @oQBXMLrp, @sSource OUT, @sDesc OUT
        SELECT "Object" = @sObjectName, "Function" = 'CreateObject', "HR" = convert(varbinary(4),@iHR), "Source" = @sSource, "Description" = @sDesc
    END
    ELSE BEGIN
        SELECT "Object" = @sObjectName, "Function" = 'CreateObject', "HR" = convert(varbinary(4),0), "Source" = '', "Description" = 'Successfully Created'
    END

    EXEC @iHR = sp_OADestroy @oQBXMLrp
    SET @iCnt = @iCnt + 1
END
0
Comment
Question by:azfronz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 34

Accepted Solution

by:
arbert earned 500 total points
ID: 10954120
If it's actually running under the scheduler, it would be called with the SQLAgent USER/Password....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question