0

We are trying to save a DataFrame in SQL Server (V2005) using the following method:

df_cards.write.jdbc(url=conn_str, table=tablename, mode='append', properties=properties)

However, we encountered the following error:

org.apache.spark.SparkSQLException: Unrecognized SQL type -151

The most puzzling part is that the data has been saved in the database.

Somebody can help us?

Thank you in advance for your help.

3
  • You are using a version of SQL Server that is so long out of support it's no surprise it behaves unexpectedly
    – Dale K
    Commented Jul 26, 2023 at 7:12
  • It sometimes chokes like this in getCatalystType() when selecting back the data back from the target table. Do you have a column with a user-defined type in the target table? Commented Jul 26, 2023 at 7:38
  • Hi AlwaysLearning. We have the problem with two columns of type datetime in SQL, dont have a user-defined type in the target table . We suspect that because when we do a select we must cast those columns. Any idea to solve it?
    – Moisés
    Commented Jul 26, 2023 at 7:47

0