Click here to Skip to main content
6,822,123 members and growing! (17,338 online)
Email Password   helpLost your password?
Database » Database » SQL Server License: The Code Project Open License (CPOL)

SFTP with SSIS Packages

By Clement Prashant Baker

An easy approach to access SFTP sites from SSIS packages
Posted:19 Feb 2008
Views:14,264
Bookmarked:12 times
Unedited contribution
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
5 votes for this article.
Popularity: 2.50 Rating: 3.57 out of 5
1 vote, 20.0%
1

2
1 vote, 20.0%
3
1 vote, 20.0%
4
2 votes, 40.0%
5

Introduction

By default SQL Server Integration Services (SSIS) do not support access to SFTP sites. One way of getting it done is by using 3rd Party software, which might be expensive. If you have simpler needs then this article is for you. Its a kind of workaround but it works.

Background

I had this situation in my project where I should update my SSIS package to retrieve files from SFTP site rather than the regular FTP. The problem starts here, SSIS does not support SFTP protocol by default. I did made a lot of search on internet and all my friends. What I could figure out was that the only method is to use third party extensions (which are definitely pricey). My requirment was very simple, only need to download files for which it was not feasible to purchase a third party software. After lots of research I would do it with a work-around. I though my experience would be useful to someone else.

Using the Code

There's a free tool called WinSCP which provides command line utility to communicate with SFTP sites. Just need to understand the scripting language for command line and execute the executable from SSIS.

What you need to do

1. Installed WinSCP client utility from http://winscp.net/eng/download.php
2. Command line utility is located at C:\Program Files\WinSCP\WinSCP.Com
3. Create a script file (say myscript.txt). The following sample might give you some idea.

option batch on
option confirm off
open sftp://user:password@ipaddress:port
cd mydir
option transfer binary
get *.dat c:\mylocaldir
# Move the contents on remove folder
mv *.dat ./backup/*
close
exit

4. Invoke the WinSCP.com executable from SSIS (or a scheduled task in windows) with the following syntax.

"C:\Program Files\WinSCP\WinSCP.com" -script=c:\myscript.txt

Summary

If you have a problem statement wherein you need to perform simpler tasks from SFTP web sites viz. retrieving or uploading files and do not wish to spend much time & money, then you can go with this workaround. If you do face any issues please email me at prashant.baker@yahoo.com. You can also find some documentation/samples on winscp web site.

You can also find this article at my blog - http://prashantbaker.blogspot.com/search/label/SSIS

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Clement Prashant Baker


Member
Prashant has around 8 years of experience in the IT industry. As an solutions architect (in India) he has designed/implemented couple of prestigious banking products, which now are being implented across the country. Since couple of years, he has been focussing on designing/implementing EAI/B2B applications using BizTalk Server. He is currently residing in New Jersey, USA.
Occupation: Architect
Company: Pixel Systems Inc.
Location: United States United States

Other popular Database articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
GeneralGuide to using WinSCP as task in SSIS Pinmemberprikryl22:22 1 Apr '09  
QuestionConnecting WinSCP with SSIS Pinmemberavik107:36 24 Oct '08  
AnswerRe: Connecting WinSCP with SSIS PinmemberEugene Mayeski22:20 19 Dec '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 19 Feb 2008
Editor:
Copyright 2008 by Clement Prashant Baker
Everything else Copyright © CodeProject, 1999-2010
Web22 | Advertise on the Code Project