Link to home
Start Free TrialLog in
Avatar of KevinKFLA
KevinKFLA

asked on

Running DTS Package with ASP

Hello,
I'm trying to run a DTS package through an ASP page but having trouble getting the package to run. Here is the type of connection I'm using to run the package. I can run
the package in Enterprise manager fine but cannot execute it through the web. I created the DTS package with the SA account on the server using SQL authentication. I'm using UNC linking for all the links in the DTS package as well. I still believe that it's a security problem between the webserver and sql server. I'm not sure if I need to edit hte permissions on the IUSR_Webserver account or need to setup the package using windows NT authentication and using a trusted connection in the package. But I'm not too sure on how to set that up.
Here is the error that I'm getting

Create Table SCLevels_summary Step failed.
Copy Data from SCLevels_summary to SCLevels_summary Step failed.

and below is the code I'm using to run the package. Any help would be greatly appreciated.


 Dim objPkg, strError, iCount

  'Create and Execute the package
  Set objPkg = Server.CreateObject("DTS.Package")
  objPkg.LoadFromSQLServer "SQLServer", "username", "password", _
    DTSSQLStgFlag,"","","","DTS_SCLevelstest2"
  objPkg.Execute
 
  'Check For Errors
  For iCount = 1 To objPkg.Steps.Count
    If objPkg.Steps(iCount).ExecutionResult = DTSStepExecResult_Failure Then
      strError = strError + objPkg.Steps(iCount).Name + " failed. " + chr(13)
    End If
  Next
 
  If strError = "" Then
    Response.Write "Success"
  Else
    Response.Write strError
  End If

  Set objPkg = Nothing
Avatar of gbaren
gbaren
Flag of United States of America image

To resolve security issues, create a local user on the database server with the exact same name and password as the one who's running the DTS package from the web server.

In other words, if an anonymous user on the Webserver is running it, and the user name is IUSR_Webserver, then create IUSR_Webserver on the database server locally. Assign the necessary permissions to the local user.

This is the LanServer security holdover. Local users on separate machines with the same name and password are considered the same.

I had very much the same issues with OLAP accross domains and this method worked out.
Avatar of robbert
robbert

gbaren is right.

Alternatives are a) putting DTS.Package to an Component Services / MTS package and running it as "this" user, and b) executing the DTS package by an ADODB.Command object (that would allow to run under the sa account).
Let me know which way you want to go.
Avatar of KevinKFLA

ASKER

I'm in the process of trying your suggestion, At the moment the sql server is down while our IT's add a new drive. I just want to make sure I do the right thing. I need to create a local account on the SQL box with the same permissions/Username/pass to match the one on the Server box (the iusr_account that the webserver uses)? or just make one that matches the username an password that I'm calling in my code above? Also I'm not sure if this is the easiest and best method. All this Package is doing is running an export to an excel spreadsheet for users to download.
SQL Server 2k -- then, there's probably another solution.
I created an account on the SQL box with the same username and password I'm using to run the package and that did not work for me it's still erroring out with the same message as above. I'm not sure what to try next.

Did you create a SQL Server account with the new userid?

Did you assign permissions for that account to run the DTS job?

What is the userid of the account you created on the SQL box?

What is the error message you are seeing?

*** ON ANOTHER TRACK: ***

What user id is the SQLSERVERAGENT using to log on?

If it is using the LocalSystem account, try changing it to a Domain Administrator account.
I created a local user on the SQL box to match that of the IUSR_webserver account and also created a new sql user with the same username on enterprise manager that can execute the DTS package.

The error message I get from my ASP code is as follows

Create Table SCLEVELS Step failed. Copy Data from SCLEVELS to SCLEVELS Step failed.

What user id is the SQLSERVERAGENT using to log on?
Not sure ???

ASKER CERTIFIED SOLUTION
Avatar of gbaren
gbaren
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
that service is using the localsystem account and when I try to change it to the domain admin or any other user for that matter I get the following error message

Cannot set the startup parameters for the SQLServeragent, service ERROR 1057 occurried the account name is invalid

I've been researching other ways of trying to complete this task do you know if it is would be easier to run this as a job in SQL Server? Can that be done by calling an object with asp?
I figured it out using the Job option in SQL Server then calling that with asp. Thanks for the help though.
I'm glad you got it running. Invalid account, btw, is probably because you need to use DOMAIN\USERID format for the USERID.