jdbc.SQLServerException: The "variant" data type is not supported

Renos Bardhis picture Renos Bardhis · Sep 12, 2019 · Viewed 7.4k times · Source

I use pyspark 2.4.4 when I am getting the data from SQL Server I get com.microsoft.sqlserver.jdbc.SQLServerException: The "variant" data type is not supported.

What is needed to do? to fix this problem. I read this. But, I do not understand.

EDIT: The following is the code I use to create the error message:

for i in df['name']: mssql_df = spark.read.format("jdbc") \ 
.option("url", "jdbc:sqlserver://SERVERNAME:1433;databaseName=DB;integratedSecurity=true") \ 
.option("dbtable", "[" + i + "]") \ 
.option("driver", 'com.microsoft.sqlserver.jdbc.SQLServerDriver').load()

Answer

Derek Mwachinga picture Derek Mwachinga · Dec 12, 2019

This answer comes a bit late but might be of help to future searches for solution of that error. I simply upgraded my connector from version 6.1.0.jre8 to 8.1.0.jre8-preview and the error was resolved.

You can check for latest version in Maven Repository.