Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use sftp from within an MS Access database module?

I have a requirement to create a simple database in Access to collect some user data that will be loaded into another database for further reporting. There will be a module in the Access db that when invoked by the user (probably by clicking a button) will output a query to a delimited file. The user also needs a mechanism (for example a form with a button) to easily transfer the file to a remote server, using sftp. Does anyone have an idea of how to accomplish this?

like image 608
jamz Avatar asked Oct 14 '08 18:10

jamz


People also ask

How do I transfer files using secure File Transfer Protocol (SFTP)?

You need to create an automated process to transfer files using Secure File Transfer Protocol (SFTP) with SQL Server Agent . Check out this article to learn how. These are the versions used for our examples:

How do I run a SFTP test from a batch file?

Open a command prompt and call sftptest.bat If we execute the batch file again, we won't be prompted for the key. The point is to automate this so let's create a SQL Server Agent Job to call it. New Job… Chose Operating system (CmdExec) in the Type dropdown Enter the full path to C:\SftpTesting\SftpScripts\sftptest.bat Click OK twice.

How to use psftp to download files from SSIs?

A work around for this will be to use PSFTP through an Execute Process Task in SSIS to download the file to our local machine. PSFTP is a SFTP client tool provided by PuTTy to transfer files between computer systems using the SFTP protocol.

How do I create a SFTP file transfer using WinSCP?

Useful Functionality in WinSCP. Now that stepped through manually creating an automated SFTP file transfer let's look at some very useful functionality in WinSCP. Run WinSCP.exe to open the GUI client. Select SFTP in File Protocol dropdown. Enter Host name. Port number. Enter User name. Enter Password. Click Login.


2 Answers

You can simply write a call to the sftp command line client via a batch file if you want to accomplish that.

Check out the Shell() function in VBA.

Under the click event of the button on your form add in the code:

mySFTPCall = "sftp <insert your options here!>"
Call Shell(mySFTPCall, 1)

I've used this before to just copy files straight across network shares etc. to share data from an in-house Access DB. Of course you could get more fancy if necessary.

like image 80
Mat Nadrofsky Avatar answered Sep 21 '22 18:09

Mat Nadrofsky


You can use our SFTPBlackbox (ActiveX Edition).

like image 39
Eugene Mayevski 'Callback Avatar answered Sep 21 '22 18:09

Eugene Mayevski 'Callback