Solved

Running DTS Package with ASP

Posted on 2001-06-19
11
341 Views
Last Modified: 2013-11-30
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
0
Comment
Question by:KevinKFLA
[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
  • 5
  • 4
  • 2
11 Comments
 
LVL 5

Expert Comment

by:gbaren
ID: 6207277
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.
0
 
LVL 15

Expert Comment

by:robbert
ID: 6207608
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.
0
 

Author Comment

by:KevinKFLA
ID: 6207837
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.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 15

Expert Comment

by:robbert
ID: 6207901
SQL Server 2k -- then, there's probably another solution.
0
 

Author Comment

by:KevinKFLA
ID: 6211373
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.

0
 
LVL 5

Expert Comment

by:gbaren
ID: 6211410
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.
0
 

Author Comment

by:KevinKFLA
ID: 6211532
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 ???

0
 
LVL 5

Accepted Solution

by:
gbaren earned 200 total points
ID: 6211556
Go into your services (right-click manage on My Computer in W2K or in control panel in NT) and check the logon information for the SQLSERVERAGENT service. I believe that is the service that runs DTS jobs.

I'm not sure whether the SQL Server Agent or current user runs DTS jobs. I'm leaning toward the Agent.
0
 

Author Comment

by:KevinKFLA
ID: 6211687
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?
0
 

Author Comment

by:KevinKFLA
ID: 6215573
I figured it out using the Job option in SQL Server then calling that with asp. Thanks for the help though.
0
 
LVL 5

Expert Comment

by:gbaren
ID: 6215627
I'm glad you got it running. Invalid account, btw, is probably because you need to use DOMAIN\USERID format for the USERID.
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

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…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

729 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