Simba Spark Driver fails for big datasets in Excel

pvalcheva
New Contributor

pvalcheva_0-1750755864726.png

Hello, I am getting the following error when I want to extract data from Databricks via VBA code. The code for the connection is:

Option Explicit

Const adStateClosed = 0

Public CnAdo As New ADODB.Connection
Dim DSN_name As String
Dim WB As Workbook
Dim dashWS As Worksheet
Dim sqlWS As Worksheet

Public Sub Check_CnAdo_Open()

' Set workbook and worksheet references
Set WB = ThisWorkbook
Set dashWS = WB.Sheets("Dashboard")
Set sqlWS = WB.Sheets("Dashboard") ' Change if needed

' Read DSN name from Dashboard named cell
DSN_name = dashWS.Range("DSN_name").Value

' Only open if not already open
If CnAdo.State = adStateClosed Then
CnAdo.ConnectionString = _
"DSN=" & DSN_name & ";" & _
"UseNativeQuery=1;" & _
"EnableResultCache=1;" & _
"SSL=1;" & _
"DisableCloudResultStorage=1;"

CnAdo.CommandTimeout = 3600

On Error GoTo ErrHandler
CnAdo.Open
End If

Exit Sub

ErrHandler:
MsgBox "Connection failed: " & Err.Description, vbCritical, "ODBC Connection Error"

End Sub