Archived Forum Post

Index of archived forum posts

Question:

Failed to connect to FTP server (SQL)

May 02 '13 at 21:39

Hi Everybody,

I used the code from http://www.example-code.com/sql/ftp.asp to create a store procedure to transfer file via ftp protocal In the script, I added some info below:

EXEC @hr = sp_OACreate 'Chilkat.Ftp2', @ftp OUT

EXEC sp_OASetProperty @ftp, 'Hostname', *
EXEC sp_OASetProperty @ftp, 'Username',

EXEC sp_OASetProperty @ftp, 'Password', *

EXEC sp_OASetProperty @ftp, 'Port',
( The ftp server is open at port 22)

After I ran the store procedure and got the message below:

ChilkatLog:

Connect_Ftp2:

DllDate: Dec 12 2012        
UnlockPrefix: ***
Username: ****
Architecture: Little Endian; 64-bit
Language: ActiveX / x64
VerboseLogging: 0
ProgressMonitoring:
  enabled: yes
  heartbeatMs: 0
  sendBufferSize: 65536
--ProgressMonitoring
ImplicitSsl: 0
AuthTls: 0
AuthSsl: 0
Hostname: ***
Port: 22
IdleTimeoutMs: 60000
ConnectTimeout: 60
HeartbeatMs: 0
ConnectTimeoutMs_1: 60000
calling ConnectSocket2
IPV6 enabled connect with NO heartbeat.
connectingTo: ***
resolveHostname1:
  dnsCacheLookup: ***
  Resolving domain name (IPV4)
--resolveHostname1
GetHostByNameHB_ipv4: Elapsed time: 0 millisec
myIP_1: ***
myPort_1: 64885
connect successful (1)
Turning on TCP_NODELAY.
socketOptions:
  SO_SNDBUF: 8192
  SO_RCVBUF: 8192
  TCP_NODELAY: 8193
--socketOptions
readFtpControlChannelReply:
  Questionable FTP reply received.
  FtpReply: SSH-2.0-CrushFTPSSHD

  ftpReceiveUntilMatch2:
    receiveUntilMatchSb:
      Timeout waiting to read socket or accept connection
      timeoutMs: 60000
      Failed to receive more bytes.
    --receiveUntilMatchSb
  --ftpReceiveUntilMatch2
  Failed to receive multiline FTP reply.
--readFtpControlChannelReply
initialStatus: 999
initialResponse: SSH-2.0-CrushFTPSSHD

Failed to connect to FTP server.
Failed.

--Connect_Ftp2 --ChilkatLog

Because I want to connect to that ftp folder via port 22. Should I use
EXEC @hr = sp_OACreate 'Chilkat.SFtp', @sftp OUT or EXEC @hr = sp_OACreate 'Chilkat.Ssh', @ssh OUT instead of EXEC @hr = sp_OACreate 'Chilkat.Ftp2', @ftp OUT ? I changed to 'Chilkat.Ssh', 'Chilkat.SFtp' but it didn't show any message. Would you help to show me how to solve this error? Thank you


Answer

"SFTP" is the Secure File Transfer Protocol over SSH. It is a protocol unrelated to the FTP protocol. The Chilkat SSH / SFTP component is used for "SFTP". SFTP is achieved by connecting to an SSH server at port 22.

On the other hand, the Chilkat FTP2 component is for FTP. FTP servers listen at port 21 (non-SSL/TLS) and port 990 (SSL). FTP over SSL (i.e. port 990) is called "FTPS".


Answer

Thank you very much for your answer. I'm a newbie to this topic.

Would like ta have 1 more question about this. I got this message when I changed the code from EXEC @hr = sp_OACreate 'Chilkat.Ftp2', @ftp OUT to
EXEC @hr = sp_OACreate 'Chilkat.Ssh', @ssh OUT

The unlock code is a valid one, but for the wrong product. If the Chilkat Bundle was purchased, find and use the unlock code containing the following product substring: requiredProductSubstring: SSH For a 30-day trial, pass a string such as "Hello World" to UnlockComponent.

This mean I got unlock code for Ftp2 product. And now if I want to use Ssh, I should buy another unlock code, right? Thank you