Courseiva
Using Spark Connect →easyMultiple Choice

Databricks-Spark-Assoc Using Spark Connect Practice Question

A data analyst wants to connect a local Python script to a Databricks cluster using Spark Connect. The workspace URL and a personal access token are available. Which client-side step is required to create the remote Spark session?

⚠ Common exam trap

Watch out — candidates often confuse local Spark configuration variables like `SPARK_HOME` with the remote connection mechanism that Spark Connect actually requires.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Call `SparkSession.builder.remote("sc://<workspace-url>:443/;token=<token>;use_ssl=true").getOrCreate()`.

Spark Connect clients create a remote session by passing a connection string to the builder's `remote` method or the `connect` function. The `sc://` URL encodes the workspace host, port 443, authentication token, and SSL flag, allowing the thin client to establish a gRPC channel to the Databricks cluster.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Add the Databricks JDBC driver to the classpath and open a JDBC connection with the token as the password.

    Why it's wrong here

    JDBC is a SQL connectivity protocol, not the Spark Connect gRPC protocol. While Databricks offers JDBC/ODBC drivers for SQL warehouses, Spark Connect sessions are created through the `remote` builder or `connect` API. Using JDBC would not yield a SparkSession with DataFrame operations.

  • ✓

    Call `SparkSession.builder.remote("sc://<workspace-url>:443/;token=<token>;use_ssl=true").getOrCreate()`.

    Why this is correct

    The `remote` method on the builder accepts a Spark Connect connection string. The `sc://` scheme with host, port, token, and SSL parameters establishes the gRPC connection to the Databricks workspace. This is the documented pattern for creating a remote session from a local Python environment without a local Spark installation.

  • ✗

    Set the `SPARK_HOME` environment variable to the Databricks workspace URL and call `SparkSession.builder.getOrCreate()`.

    Why it's wrong here

    `SPARK_HOME` points to a local Spark installation directory, not a remote workspace URL. Setting it to a URL does not establish a Spark Connect session and would not authenticate to Databricks. This misuses an environment variable meant for local Spark binaries.

  • ✗

    Install and start a local Spark master with `start-master.sh`, then connect the script to that local master.

    Why it's wrong here

    The scenario calls for connecting to a Databricks cluster, not running a local Spark cluster. Starting a local master creates a separate, local execution environment and does not use Spark Connect or the Databricks workspace. It fails to satisfy the requirement of remote connectivity.

About these practice questions

One of 295 original Databricks-Spark-Assoc practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-Spark-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-Spark-Assoc exam.