SQL Server Stored Procedure Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
DKIM / DomainKey
FTP
HTML Conversion
HTTP
MHT
MIME
NTLM
RSA
Diffie-Hellman
DSA
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
String
Tar
Upload
XML
XMP
Zip

Amazon S3
Bz2
CSV
FileAccess
Byte Array
RSS
Atom
Self-Extractor

SSH using SOCKS Proxy

Demonstrates how to connect to an SSH server through a SOCKS4 or SOCKS5 proxy.

Download Chilkat 32-bit SSH / SFTP ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @ssh int
    EXEC @hr = sp_OACreate 'Chilkat.Ssh', @ssh OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    --  Unlock the SSH component:
    EXEC sp_OAMethod @ssh, 'UnlockComponent', @success OUT, 'Anything for 30-day trial.'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @ssh, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    --  To use a SOCKS4 or SOCKS5 proxy, simply set the following
    --  properties prior to connecting:
    --  The SOCKS hostname may be a domain name or
    --  IP address:
    EXEC sp_OASetProperty @ssh, 'SocksHostname', 'www.mysocksproxyserver.com'
    EXEC sp_OASetProperty @ssh, 'SocksPort', 1080
    EXEC sp_OASetProperty @ssh, 'SocksUsername', 'myProxyLogin'
    EXEC sp_OASetProperty @ssh, 'SocksPassword', 'myProxyPassword'

    --  Set the SOCKS version to 4 or 5 based on the version
    --  of the SOCKS proxy server:
    EXEC sp_OASetProperty @ssh, 'SocksVersion', 5

    --  Note: SOCKS4 servers only support usernames without passwords.
    --  SOCKS5 servers support full login/password authentication.

    --  Connect to an SSH server via a SOCKS proxy:
    DECLARE @hostname nvarchar(4000)

    DECLARE @port int

    --  Hostname may be an IP address or hostname:
    SELECT @hostname = '192.168.1.108'
    SELECT @port = 22

    EXEC sp_OAMethod @ssh, 'Connect', @success OUT, @hostname, @port
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @ssh, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    --  Your application is now connected to an SSH server
    --  through a SOCKS4 or SOCKS5 proxy.
    --  ...

END
GO

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.