OHDSI Home | Forums | Wiki | Github

Error trying to connect to Databricks in StrategusCodeToRun.R script

I’m executing Strategus based on the instructions in the SOS video given by @anthonysena. KeyringSetup.R executes without any issues (with the modifications I’ve made for my configuration).

When I run StrategusCodeToRun.R I get the error shown below for the execute function.

However, when I test the connectionDetails I do not get this error (see output below).

I’m guessing that maybe the execute function does not use the connectionDetails object directly but pulls parameters out of it (and maybe also from the keyring?).

What do I need to do to get execute to connect to my Databricks instance?

Is there a way I can step through the execute function in the StrategusCodeToRun.R script to see how the connection is being made and why it is failing (I’m new(ish) to R and R-Studio)?

Scripts and output are attachd.
KeyringSetup.R.txt (3.9 KB)
StrategusCodeToRun.R.txt (2.7 KB)
output.txt (12.7 KB)

Error Seen for execute function in StrategusCodeToRun.R

> 
> execute(
+   analysisSpecifications = analysisSpecifications,
+   executionSettings = executionSettings,
+   executionScriptFolder = file.path(outputLocation, connectionDetailsReference, "strategusExecution"),
+   keyringName = "sos-challenge"
+ )
Connecting using Spark JDBC driver
Error in rJava::.jcall(jdbcDriver, "Ljava/sql/Connection;", "connect",  : 
  java.sql.SQLException: [Databricks][DatabricksJDBCDriver](500593) Communication link failure. Failed to connect to server. Reason: HTTP Response code: 401, Error message: Unknown.
> 

Output from test of connection

> # --- start test of connectionDetails -----------------------------------------------------------
> testConnection <- DatabaseConnector::connect(connectionDetails)
Connecting using Spark JDBC driver
> testConnection 
<DatabaseConnectorConnection> nachc-databricks.cloud.databricks.com> 
DatabaseConnector::querySql(testConnection, "show tables in demo_cdm")
   DATABASE               TABLENAME ISTEMPORARY
1  demo_cdm    attribute_definition           0
2  demo_cdm               care_site           0
3  demo_cdm              cdm_source           0
4  demo_cdm                  cohort           0
5  demo_cdm     cohort_censor_stats           0
6  demo_cdm       cohort_definition           0
7  demo_cdm        cohort_inclusion           0
8  demo_cdm cohort_inclusion_result           0
9  demo_cdm  cohort_inclusion_stats           0
10 demo_cdm    cohort_summary_stats           0
11 demo_cdm                 concept           0
12 demo_cdm        concept_ancestor           0
13 demo_cdm           concept_class           0
14 demo_cdm    concept_relationship           0
15 demo_cdm         concept_synonym           0
16 demo_cdm           condition_era           0
17 demo_cdm    condition_occurrence           0
18 demo_cdm                    cost           0
19 demo_cdm                   death           0
20 demo_cdm         device_exposure           0
21 demo_cdm                  domain           0
22 demo_cdm                dose_era           0
23 demo_cdm                drug_era           0
24 demo_cdm           drug_exposure           0
25 demo_cdm           drug_strength           0
26 demo_cdm       fact_relationship           0
27 demo_cdm                location           0
28 demo_cdm             measurement           0
29 demo_cdm                metadata           0
30 demo_cdm                    note           0
31 demo_cdm                note_nlp           0
32 demo_cdm             observation           0
33 demo_cdm      observation_period           0
34 demo_cdm       payer_plan_period           0
35 demo_cdm                  person           0
36 demo_cdm    procedure_occurrence           0
37 demo_cdm                provider           0
38 demo_cdm            relationship           0
39 demo_cdm   source_to_concept_map           0
40 demo_cdm                specimen           0
41 demo_cdm            visit_detail           0
42 demo_cdm        visit_occurrence           0
43 demo_cdm              vocabulary           0
> DatabaseConnector::disconnect(testConnection)
> # --- end test of connectionDetails -------------------------------------------------------------
> 

Thanks,
John

t