Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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()
like image 280
Renos Bardhis Avatar asked Oct 21 '25 19:10

Renos Bardhis


2 Answers

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.

like image 130
Derek Mwachinga Avatar answered Oct 24 '25 10:10

Derek Mwachinga


https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc mssql-jdbc from version 6.3.x up to current all support "variant" data type. You just update dependency to resolve your problem.

like image 43
Nghiem Xuan Hieu Avatar answered Oct 24 '25 08:10

Nghiem Xuan Hieu