如何通过ssis package 2008 r2从ftp服务器下载文件 [英] How to download files from ftp server through ssis package 2008 r2

查看:75
本文介绍了如何通过ssis package 2008 r2从ftp服务器下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我必须从ftp服务器下载文件以插入到sql server 2008.How我可以通过ssis包...

Hi All,
I have to download files from ftp server to insert in to sql server 2008.How can i do it through ssis package...

推荐答案

使用脚本任务并将文件下载到文件系统中。例如(来自MSDN):

Use Script Task and download files into your file system. Eg(from MSDN):
using System;
using System.IO;
using System.Net;
using System.Text;

namespace FTPExample
{
    public class WebRequestGetExample
    {
        public static void Main ()
        {
            // Get the object used to communicate with the server.
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
            request.Method = WebRequestMethods.Ftp.DownloadFile;

            // This example assumes the FTP site uses anonymous logon.
            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");

            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
    
            Stream responseStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream);
            Console.WriteLine(reader.ReadToEnd());

            Console.WriteLine("Download Complete, status {0}", response.StatusDescription);
    
            reader.Close();
            response.Close();  
        }
    }
}


这篇关于如何通过ssis package 2008 r2从ftp服务器下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆