The SAS Viya platform supports access to the Databricks database using the SAS/ACCESS Interface to Spark components. The SAS/ACCESS interface to Spark includes two main components, including the Spark data connector. The Spark data connector enables the user to connect Spark-compatible data sources from CAS. The SAS Viya platform includes the SAS/ACCESS interface to Spark with the Simba Databricks JDBC driver to connect to the Databricks database.
In this post, I discuss the database access from CAS to Databricks using the Simba Databricks JDBC driver.
Databricks is a cloud-enabled, unified database for maintaining and sharing enterprise data across various applications. Databricks is a Spark data platform that runs in a hosted cloud environment, such as Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure. The SAS ACCESS/Interface to Spark and Spark data connector supports the following versions of Databricks.
Microsoft Azure Databricks 10.4 or later
Databricks on AWS 10.4 or later
Databricks on GCP 10.4 or later
The SAS/ACCESS interface to Spark and data connector supports user ID and password-based authentication for the Databricks database. The Single-Sign-On access to Azure Databricks is supported when the SAS Viya platform is configured with the Azure Entra ID.
The Simba Databricks JDBC Data Connector uses the Apache Arrow library to efficiently transfer result sets from Databricks to the client. The Arrow library requires the JRE option cas.jreoptions = string.sub(cas.jreoptions, 1, -2) .. ' –add opens=java.base/java.nio=ALL-UNNAMED)' to be passed to the SAS Java Runtime Environment at startup. This property must be set in the CAS compute context. A configuration step must be performed in the SAS Environment Manager under sas.cas.instance config: config and the CAS services must be restarted.
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
UserId-Password-based access from CAS to Azure DataBricks
With the Databricks JDBC Simba driver, some option names have changed compared to the CDATA JDBC driver. With Azure Databricks Workspace, SPARK Cluster, database table, and JDBC driver in place, you can use the following code to load the CAS table from the Azure Databricks table. The Simba JDBC Spark driver is part of the SAS Viya deployment and used by the SAS data connector to connect to the Databricks database. The Azure Databricks Workspace token (key) is used as the password to authenticate to the environment. To access the Unity catalog, use the ConnCatalog=; parameter in the properties option.
Code:
%let MYDBRICKS=adb-909170011386784.4.azuredatabricks.net;
%let MYHTTPPATH=sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4;
%let MYPWD=dapia48975169845df393f7c25771ee56c4b-3;
%let MYCATALOG=ws_basic_p41901_rg;
%let MYUID=token;
%let MYDRIVERCLASS=com.simba.databricks.jdbc.Driver;
%let MYSCHEMA=default;
CAS mySession SESSOPTS=( CASLIB=casuser TIMEOUT=99 LOCALE="en_US");
/* User/PWD based CASLIB to Databricks */
caslib Cdtspkcaslib datasource=(srctype='spark',
platform=databricks,
username="&MYUID",
password="&MYPWD",
schema="&MYSCHEMA",
server="&MYDBRICKS",
httpPath="&MYHTTPPATH",
driverclass="&MYDRIVERCLASS",
bulkload=no,
port=443,
useSsl=yes,
charMultiplier=1,
dbmaxText=50,
properties="ConnCatalog=&MYCATALOG;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20"
);
proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
list files ;
quit;
/* Load CAS from DataBricks database table */
proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
load casdata="iot_device" casout="iot_device" replace;
list tables;
quit;
/* Save CAS data to DataBricks database */
proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib";
load data=sashelp.cars casout="cars" replace;
save casdata="cars" casout="cars_sas" replace;
list files;
quit;
CAS mySession TERMINATE;
Log:
81 %let MYDBRICKS=adb-909170011386784.4.azuredatabricks.net;
82 %let MYHTTPPATH=sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4;
83 %let MYPWD=dapia48975169845df393f7c25771ee56c4b-3;
84 %let MYCATALOG=ws_basic_p41901_rg;
85
86 %let MYUID=token;
87 %let MYDRIVERCLASS=com.simba.databricks.jdbc.Driver;
88 %let MYSCHEMA=default;
89
94
95 CAS mySession SESSOPTS=( CASLIB=casuser TIMEOUT=99 LOCALE="en_US");
NOTE: The session MYSESSION connected successfully to Cloud Analytic Services sas-cas-server-default-client using port 5570. The
UUID is 93c222e3-d706-754a-a0cc-76b96073f761. The user is geldmui@gelenable.sas.com and the active caslib is
CASUSER(geldmui@gelenable.sas.com).
NOTE: The SAS option SESSREF was updated with the value MYSESSION.
NOTE: The SAS macro _SESSREF_ was updated with the value MYSESSION.
NOTE: The session is using 2 workers.
NOTE: 'CASUSER(geldmui@gelenable.sas.com)' is now the active caslib.
NOTE: The CAS statement request to update one or more session options for session MYSESSION completed.
96
97 /* User/PWD based CASLIB to Databricks */
98 caslib Cdtspkcaslib datasource=(srctype='spark',
99 platform=databricks,
100 username="&MYUID",
101 password="&MYPWD",
102 schema="&MYSCHEMA",
103 server="&MYDBRICKS",
104 httpPath="&MYHTTPPATH",
105 driverclass="&MYDRIVERCLASS",
106 bulkload=no,
107 port=443,
108 useSsl=yes,
109 charMultiplier=1,
110 dbmaxText=50,
111 properties="ConnCatalog=&MYCATALOG;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20"
112 );
NOTE: 'CDTSPKCASLIB' is now the active caslib.
NOTE: Cloud Analytic Services added the caslib 'CDTSPKCASLIB'.
NOTE: Action to ADD caslib CDTSPKCASLIB completed for session MYSESSION.
113
114
115
116 proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
NOTE: The UUID '93c222e3-d706-754a-a0cc-76b96073f761' is connected using session MYSESSION.
117 list files ;
CAS File Information
Name Catalog Schema Type Description
cars_sas CDTSPKCASLIB default TABLE
iot_device CDTSPKCASLIB default TABLE
prdsal2_sas1 CDTSPKCASLIB default TABLE
prdsal2_sas2 CDTSPKCASLIB default TABLE
NOTE: Cloud Analytic Services processed the combined requests in 3.472769 seconds.
118 quit;
NOTE: PROCEDURE CASUTIL used (Total process time):
real time 3.51 seconds
cpu time 0.05 seconds
119
120 /* Load CAS from DataBricks database table */
121 proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
NOTE: The UUID '93c222e3-d706-754a-a0cc-76b96073f761' is connected using session MYSESSION.
122 load casdata="iot_device" casout="iot_device" replace;
NOTE: Performing serial LoadTable action using SAS Data Connector to Spark.
NOTE: Cloud Analytic Services made the external data from iot_device available as table IOT_DEVICE in caslib Cdtspkcaslib.
NOTE: The Cloud Analytic Services server processed the request in 6.598886 seconds.
123 list tables;
Caslib Information
Library CDTSPKCASLIB
Source Type spark
CharMultiplier 1
Session local Yes
Active Yes
Personal No
Hidden No
Transient No
TableRedistUpPolicy Not Specified
Uid token
Schema default
Properties ConnCatalog=ws_basic_p41901_rg;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20
HiveClass com.simba.databricks.jdbc.Driver
BulkLoad false
HttpPath sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4
UseSsl yes
Server adb-909170011386784.4.azuredatabricks.net
Port 443
DbmaxText 50
Platform databricks
Table Information for Caslib CDTSPKCASLIB
Number Number Indexed NLS Promoted Repeated
Table Name of Rows of Columns Columns encoding Created Last Modified Table Table
IOT_DEVICE 198164 15 0 utf-8 2025-12-04T21:15:09+00:00 2025-12-04T21:15:09+00:00 No No
Table Information for Caslib CDTSPKCASLIB
Java
Source Source Character Multi
Table Name View Name Caslib Compressed Accessed Set Part
IOT_DEVICE No iot_device CDTSPKCASLIB No 2025-12-04T21:15:09+00:00 UTF8 No
Table Information for Caslib CDTSPKCASLIB
Table
Redistribute Up
Table Name Creator Policy
IOT_DEVICE geldmui@gelenable.sas.com Not Specified
NOTE: Cloud Analytic Services processed the combined requests in 0.009603 seconds.
124 quit;
NOTE: PROCEDURE CASUTIL used (Total process time):
real time 6.64 seconds
cpu time 0.05 seconds
125
126 /* Save CAS data to DataBricks database */
127 proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib";
NOTE: The UUID '93c222e3-d706-754a-a0cc-76b96073f761' is connected using session MYSESSION.
128 load data=sashelp.cars casout="cars" replace;
NOTE: The INCASLIB= option is ignored when using the DATA= option in the LOAD statement.
NOTE: SASHELP.CARS was successfully added to the "CDTSPKCASLIB" caslib as "CARS".
129 save casdata="cars" casout="cars_sas" replace;
NOTE: Performing serial SaveTable action using SAS Data Connector to Spark.
NOTE: Cloud Analytic Services saved the file cars_sas in caslib CDTSPKCASLIB.
NOTE: The Cloud Analytic Services server processed the request in 5.086705 seconds.
130 list files;
Caslib Information
Library CDTSPKCASLIB
Source Type spark
CharMultiplier 1
Session local Yes
Active Yes
Personal No
Hidden No
Transient No
TableRedistUpPolicy Not Specified
Uid token
Schema default
Properties ConnCatalog=ws_basic_p41901_rg;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20
HiveClass com.simba.databricks.jdbc.Driver
BulkLoad false
HttpPath sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4
UseSsl yes
Server adb-909170011386784.4.azuredatabricks.net
Port 443
DbmaxText 50
Platform databricks
CAS File Information
Name Catalog Schema Type Description
cars_sas CDTSPKCASLIB default TABLE
iot_device CDTSPKCASLIB default TABLE
prdsal2_sas1 CDTSPKCASLIB default TABLE
prdsal2_sas2 CDTSPKCASLIB default TABLE
NOTE: Cloud Analytic Services processed the combined requests in 0.523967 seconds.
131 quit;
............
..............
SSO-based access from CAS to Azure DataBricks
The Single-Sign-On access to Azure Databricks is supported using the Simba JDBC driver when the SAS Viya platform is configured with the Azure Entra ID. The CASLIB statement must include option AUTH=OAUTH2 to use the SSO authenticated connection to DataBricks.
The Entra ID OIDC application for Databricks access must have an API permission for the Azure DataBricks. The Databricks Workspace is configured with Entra ID user access permissions.
The following code describes the SSO-based access from CAS to the Azure Databricks database. Notice, there is no user ID and password in the CASLIB statement; option AUTH=OAUTH2 is used.
Code:
%let MYDBRICKS=adb-909170011386784.4.azuredatabricks.net;
%let MYHTTPPATH=sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4;
%let MYCATALOG=ws_basic_p41901_rg;
%let MYDRIVERCLASS=com.simba.databricks.jdbc.Driver;
%let MYSCHEMA=default;
CAS mySession SESSOPTS=( CASLIB=casuser TIMEOUT=99 LOCALE="en_US");
/* SSO based CASLIB to Databricks */
caslib Cdtspkcaslib datasource=(srctype='spark',
platform=databricks,
auth=oauth2,
schema="&MYSCHEMA",
server="&MYDBRICKS",
httpPath="&MYHTTPPATH",
driverclass="&MYDRIVERCLASS",
bulkload=no,
port=443,
useSsl=yes,
charMultiplier=1,
dbmaxText=50,
properties="ConnCatalog=&MYCATALOG;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20"
);
/* Load CAS from DataBricks database table */
proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
load casdata="iot_device" casout="iot_device" replace;
list tables;
quit;
CAS mySession TERMINATE;
Log:
80 /* Note : variable value in quotes generate errors, So keep it without quotes. */
81 %let MYDBRICKS=adb-909170011386784.4.azuredatabricks.net;
82 %let MYHTTPPATH=sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4;
84 %let MYCATALOG=ws_basic_p41901_rg;
85
87 %let MYDRIVERCLASS=com.simba.databricks.jdbc.Driver;
88 %let MYSCHEMA=default;
89
95 CAS mySession SESSOPTS=( CASLIB=casuser TIMEOUT=99 LOCALE="en_US");
NOTE: The session MYSESSION connected successfully to Cloud Analytic Services sas-cas-server-default-client using port 5570. The
UUID is 4e826b7e-a9b2-b34a-a770-37861a72cd96. The user is geldmui@gelenable.sas.com and the active caslib is
CASUSER(geldmui@gelenable.sas.com).
NOTE: The SAS option SESSREF was updated with the value MYSESSION.
NOTE: The SAS macro _SESSREF_ was updated with the value MYSESSION.
NOTE: The session is using 2 workers.
NOTE: 'CASUSER(geldmui@gelenable.sas.com)' is now the active caslib.
NOTE: The CAS statement request to update one or more session options for session MYSESSION completed.
96
97 /* SSO based CASLIB to Databricks */
98 caslib Cdtspkcaslib datasource=(srctype='spark',
99 platform=databricks,
100 auth=oauth2,
101 schema="&MYSCHEMA",
102 server="&MYDBRICKS",
103 httpPath="&MYHTTPPATH",
104 driverclass="&MYDRIVERCLASS",
105 bulkload=no,
106 port=443,
107 useSsl=yes,
108 charMultiplier=1,
109 dbmaxText=50,
110 properties="ConnCatalog=&MYCATALOG;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20"
111 );
NOTE: 'CDTSPKCASLIB' is now the active caslib.
NOTE: Cloud Analytic Services added the caslib 'CDTSPKCASLIB'.
NOTE: Action to ADD caslib CDTSPKCASLIB completed for session MYSESSION.
112
113
118
119 /* Load CAS from DataBricks database table */
120 proc casutil outcaslib="Cdtspkcaslib" incaslib="Cdtspkcaslib" ;
NOTE: The UUID '4e826b7e-a9b2-b34a-a770-37861a72cd96' is connected using session MYSESSION.
121 load casdata="iot_device" casout="iot_device" replace;
NOTE: Performing serial LoadTable action using SAS Data Connector to Spark.
NOTE: Cloud Analytic Services made the external data from iot_device available as table IOT_DEVICE in caslib Cdtspkcaslib.
NOTE: The Cloud Analytic Services server processed the request in 7.320002 seconds.
122 list tables;
Caslib Information
Library CDTSPKCASLIB
Source Type spark
CharMultiplier 1
Session local Yes
Active Yes
Personal No
Hidden No
Transient No
TableRedistUpPolicy Not Specified
Schema default
Properties ConnCatalog=ws_basic_p41901_rg;defaultStringColumnLength=255;Other=ConnectRetryWaitTime=20
HiveClass com.simba.databricks.jdbc.Driver
BulkLoad false
AuthenticationType OAUTH2
HttpPath sql/protocolv1/o/909170011386784/1203-164445-fe2dn0n4
UseSsl yes
Server adb-909170011386784.4.azuredatabricks.net
Port 443
DbmaxText 50
Platform databricks
Table Information for Caslib CDTSPKCASLIB
Number Number Indexed NLS Promoted Repeated
Table Name of Rows of Columns Columns encoding Created Last Modified Table Table
IOT_DEVICE 198164 15 0 utf-8 2025-12-04T21:08:55+00:00 2025-12-04T21:08:55+00:00 No No
Table Information for Caslib CDTSPKCASLIB
Java
Source Source Character Multi
Table Name View Name Caslib Compressed Accessed Set Part
IOT_DEVICE No iot_device CDTSPKCASLIB No 2025-12-04T21:08:55+00:00 UTF8 No
Table Information for Caslib CDTSPKCASLIB
Table
Redistribute Up
Table Name Creator Policy
IOT_DEVICE geldmui@gelenable.sas.com Not Specified
NOTE: Cloud Analytic Services processed the combined requests in 0.009624 seconds.
123 quit;
NOTE: PROCEDURE CASUTIL used (Total process time):
real time 7.37 seconds
cpu time 0.06 seconds
Important Links:
SAS/ACCESS Interface to Spark
Spark Data Connector
Authenticate to Databricks on Microsoft Azure by Using Single Sign-On
Scenario: OIDC with Microsoft Entra ID (Azure Active Directory)
Troubleshooting Spark Connection Problems
Find more articles from SAS Global Enablement and Learning here.
... View more