Downloading a file

  • Hi,

    How to download a file over http using SSIS...? what are all the steps i should do to get this done..? Some one explain me step-by-step?

    Thanks,
    Charmer

  • Well..since I am not clear with the host which has the file...

    Follow these steps:

    1. Develop a ST to do the following:

    a. Create a connection with host

    b. Create a pointer to the file

    c. Download the file

    d. Close the connection

    Hope this helps!!

    Raunak J

  • Hi,

    I'm not understanding the way...

    how can i create a connection over HTTP....what is the connection manager that i should use?

    Thanks,
    Charmer

  • Prakash,

    help us help you...don't provide information in parts...

    give a detailed brief of your situation and the methods that you have tried for a faster resolution 🙂

    Raunak J

  • I don't have any ideas about tha...

    i just wanna know whether it is possible to download a file through SSIS package...?

    if we can...i wanna see an example then...

    can you help me,Raunak?

    Thanks,
    Charmer

  • Yes it is possible in SSIS, with a script task you can pretty much do anything.

    you can use the Http connection manager with a script task,

    or else use the System.net.webclient .NET class to do it entirely in .NET.

    If you do a search on google there are loads of examples using either method.

  • Steve, I really do not see any point in spoon feeding.

    Raunak J

  • I was in the same predicament, with people in this forum being nasty and not helpful.

    Here is some code you can use, needs tweeking but worked for me.

    SSIS VB 2008 script task.

    ' Microsoft SQL Server Integration Services Script Task

    ' Write scripts using Microsoft Visual Basic 2008.

    ' The ScriptMain is the entry point class of the script.

    Imports System

    Imports System.Data

    Imports System.Math

    Imports System.Net

    Imports Microsoft.SqlServer.Dts.Runtime

    <System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _

    <System.CLSCompliantAttribute(False)> _

    Partial Public Class ScriptMain

    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

    Enum ScriptResults

    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success

    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

    End Enum

    Public Sub Main()

    Dim WebConnection As New WebClient()

    Dim connectionString As String

    Dim creds As New NetworkCredential("username", "password")

    connectionString = "https://ftp.website.com"

    Try

    With WebConnection

    .BaseAddress = connectionString

    .Credentials = creds

    End With

    Catch ex As Exception

    Dts.Events.FireError(0, "Problem connecting to website: ", ex.Message, "", 0)

    End Try

    Try

    With WebConnection

    .DownloadFile(connectionString, "\etworkshare")

    End With

    Catch ex As Exception

    Dts.Events.FireError(0, "Problem downloading file: ", ex.Message, "", 0)

    End Try

    Dts.TaskResult = ScriptResults.Success

    End Sub

    End Class

  • Hi Churl,

    i agree with you....im asking this question to the forum friends because i don't know how to get this done and even im a newbie....if their responses is like kind of weird....then what can i do?

    anyway thank you very much Churlbut,

    yes,this script looks pretty much different...

    is this for dynamic process?

    Thanks,
    Charmer

  • All you need to do is put the connection information in and where you want to download to.

    SSIS does not support HTTPS so you don't need the connection manager.

    I was uploading so you might need to make a few changes. Since you are downloading it should be relatively easy to test this out.

    Keep me posted on your progress.

  • Churl, we can use http connection manager in ssis...

    we have that option...

    i need this process dynamically...

    Thanks,
    Charmer

  • If you are don't need to do it with a secure connection try this:

    http://www.sqlis.com/post/Downloading-a-file-over-HTTP-the-SSIS-way.aspx

  • yeah...i already saw this page...

    im searching for dynamic process of downloading the file...

    Thanks,
    Charmer

  • Do you want to make Http connection string as dynamic ? if so use package configuration

    Regards - Deepak.A

  • how to do that, Deepak?

    Thanks,
    Charmer

Viewing 15 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic. Login to reply