Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

SQL Server Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(SQL Server) Use Public DNS Servers (Google and Cloudfare)

See more DNS Examples

Demonstrates how to use Google and Cloudfare nameservers for all DNS lookups within Chilkat.

Note: This example requires Chilkat v9.5.0.96 or later.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- The new Chilkat DNS class is a singleton that allows an applicaton to select 
    -- the DNS nameservers used throughout Chilkat.

    -- "singleton" means that all Chilkat DNS object instances work with a single
    -- copy of internal DNS settings that are application wide.

    -- Chilkat does DNS lookups internally whenever a domain name is passed to a Chilkat method, or when the domain
    -- name is part of a URL passed to a Chilkat method.  It could be in HTTP, Ftp2, SSH, IMAP, Socket, etc.

    -- This exampel will show how to use the Cloudfare and Google DNS servers.
    -- 
    -- Google Public DNS:
    --   - Primary DNS: 8.8.8.8
    --   - Secondary DNS: 8.8.4.4
    --   Google Public DNS is known for its speed and reliability. It's operated by Google and is widely used by many internet users.

    -- Cloudfare Public DNS:
    --   - Primary DNS: 1.1.1.1
    --   - Secondary DNS: 1.0.0.1
    --   Cloudfare Public DNS is also known for its speed and reliability, and is also widely used.

    DECLARE @dns int
    -- Use "Chilkat_9_5_0.Dns" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Dns', @dns OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    -- Indicate our TLS preference:
    -- 0: No TLS
    -- 1: Prefer TLS if possible
    -- 2: Require TLS
    EXEC sp_OASetProperty @dns, 'TlsPref', 0

    -- If you choose "No TLS", then all DNS requests will use UDP, or TCP for those requests with large responses.
    -- Choosing "No TLS" provides the fastest DNS lookups, and is generally what you're already doing.

    -- If you choose "Prefer TLS if possible", then Chilkat will use DNS over TLS for those nameservers that
    -- support TLS.

    -- If you choose "Require TLS", then Chilkat will ignore nameservers that don't support TLS,
    -- and all DNS communications will occur over private and secure TLS connections.

    -- When you specify a nameserver to be used, you'll tell Chilkat whether it supports DNS or not.
    -- Here' we're setting the nameservers to Google and Cloudfare.
    -- They both support TLS, but since we set our TLS preference = 0, Chilkat will not use TLS.
    -- (If we set our TLS preference equal to 1 or 2, then Chilkat will use TLS for Google and Cloudfare DNS.)

    -- First, make sure we remove all existing nameservers.
    EXEC sp_OAMethod @dns, 'RemoveAllNameservers', NULL

    -- Add the Google and Cloudfare nameservers.
    DECLARE @supportsTls int
    SELECT @supportsTls = 1
    EXEC sp_OAMethod @dns, 'AddNameserver', NULL, '1.1.1.1', @supportsTls
    EXEC sp_OAMethod @dns, 'AddNameserver', NULL, '8.8.8.8', @supportsTls
    EXEC sp_OAMethod @dns, 'AddNameserver', NULL, '1.0.0.1', @supportsTls
    EXEC sp_OAMethod @dns, 'AddNameserver', NULL, '8.8.4.4', @supportsTls

    -- That's it.  Now all DNS lookups in Chilkat will use the above nameservers.

    EXEC @hr = sp_OADestroy @dns


END
GO

 

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