In addition to the default thrift protocol (binary mode), the driver also supports HTTP mode, which allows you to access Apache Spark SQL data stores using HTTP/HTTPS requests. When HTTP mode is enabled, thrift RPC messages are sent to an endpoint using HTTP transport. HTTP mode is typically employed when there is a need to access data through a proxy server, such as when connecting to a load balancer or a gateway server. Unless otherwise noted, the same features and functionality are supported for both the thrift and HTTP protocols.

To connect to a server using HTTP Mode:

  1. Configure the minimum required options required for a connection:
    • Set the Database Name (Database) option to provide the name of the Spark SQL database to which you want to connect.
    • Set the Host Name (HostName) option to provide the name or the IP address of the server to which you want to connect.
    • Set the Port Number (PortNumber) option to provide the TCP port of the primary database server that is listening for connections to the Spark SQL database. The default is 10000.
  2. Set the Transport Mode (TransportMode) option to 1 (HTTP).
  3. Optionally, if not using the default HTTP endpoint, set the HTTP Path (HTTPPath) option to provide the path of the endpoint to be used for HTTP/HTTPS requests. The default is cliservice.
  4. Optionally, if you need to override the default value of the User-Agent header to one used by your service, set the User Agent Tag (UserAgent) option to specify the string value of the User-Agent header to be used in HTTP requests. If no value is specified, the following header value is used: Progress/8.0 (SparkSQL ODBC driver).
  5. Optionally, if you are sending requests to HTTPS endpoints, set the Encryption Method (EncryptionMethod) option to 1 (SSL) to enable SSL data encryption. Data encryption behavior can be further configured using the connection properties described in "Summary of data encryption related options."
  6. Optionally, if you are using cookie based authentication, configure the following options:
    • Set the Enable Cookie Authentication (EnableCookieAuthentication) to 1 (enabled).
    • Set the Cookie Name (CookieName) option to specify the name of the cookie used for authenticating HTTP requests.

The following examples demonstrate a basic configuration of HTTP mode with SSL enabled.

Using a connection URL:

DRIVER=DataDirect 8.0 Apache Spark SQL Wire Protocol;HostName=MyServer;PortNumber=10001;
DatabaseName=mydb1;EncryptionMethod=1;HTTPPath=sql/protocolv1/o/0/xxxx-xxxxxx-xxxxxxxx;
TransportMode=1;

Using the odbc.ini file:

Driver=ODBCHOME/lib/ivsparkxx.so
Description=DataDirect Apache Spark SQL Wire Protocol
...
DatabaseName=mydb1
...
EncryptionMethod=1
...
HostName=MyServer
...
HTTPPath=sql/protocolv1/o/0/xxxx-xxxxxx-xxxxxxxx
...
PortNumber=10001
...
TransportMode=1
...