Using a Connection String
For some applications, you might need to use a connection string to connect to your data source. For detailed information about how to use a connection string in an ODBC application, refer to the documentation for the application that you are using.
The connection strings in the following sections are examples showing the minimum set of connection attributes that you must specify to successfully connect to the data source. Depending on the configuration of the data source and the type of connection you are working with, you might need to specify additional connection attributes. For detailed information about all the attributes that you can use in the connection string,
DSN Connection String Example
The following is an example of a connection string for a connection that uses a DSN:
DSN=[DataSourceName]
[DataSourceName] is the DSN that you are using for the connection.
You can set additional configuration options by appending key-value pairs to the connection string. Configuration options that are passed in using a connection string take precedence over configuration options that are set in the DSN.
DSN-less Connection String Examples
Some applications provide support for connecting to a data source using a connector without a DSN. To connect to a data source without using a DSN, use a connection string instead.
The placeholders in the examples are defined as follows, in alphabetical order:
- [AccessToken] is your access token for authenticating the connection through the OAuth 2.0 protocol.
- [AOSS_Endpoint] is the IP address or host name of the DataStax AOSS endpoint.
- [AOSS_Port] is the number of the TCP port that the DataStax AOSS endpoint uses to listen for client connections.
- [ConfigFile] is the absolute path to the OCI configuration file to use for the connection.
- [DomainName] is the fully qualified domain name of the Spark server host.
- [PortNumber] is the number of the TCP port that the Spark server uses to listen for client connections.
- [Realm] is the Kerberos realm of the Spark server host.
- [Server] is the IP address or host name of the Spark server to which you are connecting.
- [ServerURL] is the partial URL corresponding to the Spark server.
- [ServiceName] is the Kerberos service principal name of the Spark server.
- [YourPassword] is the password corresponding to your user name.
- [YourUserName] is the user name that you use to access the Spark server.
Connecting to a Shark Server Instance
The following is the format of a DSN-less connection string that connects to a Shark Server instance:
Driver=Simba Spark
Host=[Server];Port=[PortNumber];
For example:
Driver=Simba Spark
Host=192.168.222.160;Port=10000;
Connecting to a Standard Spark Thrift Server Instance
The following is the format of a DSN-less connection string for a standard connection to a Spark Thrift Server instance. By default, the connector is configured to connect to a Spark Thrift Server instance. Most default configurations of Spark Thrift Server require User Name authentication. When configured to provide User Name authentication, the connector uses anonymous as the user name by default.
Driver=Simba Spark
Port=[PortNumber];AuthMech=2;
For example:
Driver=Simba Spark
Port=10000;AuthMech=2;
Connecting to a Spark Thrift Server Instance Without Authentication
The following is the format of a DSN-less connection string that for a Spark Thrift Server instance that does not require authentication.
Driver=Simba Spark
Port=[PortNumber];AuthMech=0;
For example:
Driver=Simba Spark
Port=10000;AuthMech=0;
Connecting to a Spark Server that Requires Kerberos Authentication
The following is the format of a DSN-less connection string that connects to a Spark Thrift Server instance requiring Kerberos authentication. By default, the connector is configured to connect to a Spark Thrift Server instance.
Driver=Simba Spark
Port=[PortNumber];AuthMech=1;KrbRealm=[Realm];
KrbHostFQDN=[DomainName];KrbServiceName=[ServiceName];
For example:
Driver=Simba Spark
Port=10000;AuthMech=1;KrbRealm=SIMBA;
KrbHostFQDN=localhost.localdomain;KrbServiceName=spark;
Connecting to a Spark Server that Requires User Name And Password Authentication
The following is the format of a DSN-less connection string that connects to a Spark Thrift Server instance requiring User Name and Password authentication. By default, the connector is configured to connect to a Spark Thrift Server instance.
Driver=Simba Spark
Port=[PortNumber];AuthMech=3;UID=[YourUserName];
PWD=[YourPassword];
For example:
Driver=Simba Spark
Port=10000;AuthMech=3;UID=simba;PWD=simba;
Connecting to a Spark Server on Windows Azure HDInsight Emulator
The following is the format of a DSN-less connection string that connects to a Spark Thrift Server instance running on Windows Azure HDInsight Emulator. By default, the connector is configured to connect to a Spark Thrift Server instance.
Driver=Simba Spark
Port=[PortNumber];AuthMech=5;UID=[YourUserName];
PWD=[YourPassword];HTTPPath=[ServerURL];
For example:
Driver=Simba Spark
Port=10000;AuthMech=5;UID=simba;PWD=simba;
HTTPPath=gateway/sandbox/spark;
Connecting to a Spark Server on Windows Azure HDInsight Service
The following is the format of a DSN-less connection string that connects to a Spark Thrift Server instance running on Windows Azure HDInsight Service. By default, the connector is configured to connect to a Spark Thrift Server instance.
Driver=Simba Spark
Port=[PortNumber];AuthMech=6;UID=[YourUserName];
PWD=[YourPassword];HTTPPath=[ServerURL];
For example:
Driver=Simba Spark
Port=10000;AuthMech=6;UID=simba;PWD=simba;
HTTPPath=gateway/sandbox/spark;
Connecting to a Spark Server that Requires OAuth 2.0 Authentication
The following is the format of a DSN-less connection string that connects to a Spark Thrift Server instance requiring OAuth 2.0 authentication. By default, the connector is configured to connect to a Spark Thrift Server instance.
Driver=Simba Spark
Port=[PortNumber];AuthMech=11;Auth_Flow=0;Auth_AccessToken=[AccessToken];ThriftTransport=2;
For example:
Driver=Simba Spark
Port=10000;AuthMech=11;Auth_Flow=0;Auth_AccessToken=P9QcyQ7prK2LwUMZMpFQ4R+6jd;ThriftTransport=2;
Connecting using Dynamic Service Discovery
The following is the format of a DSN-less connection string that discovers Spark services via the DataStax AOSS service.
Driver=Simba Spark ODBC Driver;ServiceDiscoveryMode=AOSS;
Host=[AOSS_Endpoint1]:[AOSS_Port1], [AOSS_Endpoint2]:[AOSS_Port2];
For example:
Driver=Simba Spark ODBC Driver;ServiceDiscoveryMode=AOSS;
Host=192.168.222.160:9077, 192.168.222.165:9077;
Connecting to a DFI Server Using an API Signing Key
The following is the format of a DSN-less connection string that connects to a DFI Server instance with an API signing key:
Driver=Simba Spark
For example:
Driver=Simba Spark
Connecting to a DFI Server Using a Token
The following is the format of a DSN-less connection string that connects to a DFI server using token-based authentication:
Driver=Simba Spark
For example:
Driver=Simba Spark
- Driver Configuration Options on page 1
- Creating a Data Source Name
- Configuring a DSN-less Connection
- Creating a Data Source Name
- Configuring a DSN-less Connection
- Configuring the Driver on page 1