Skip to content
Advertisement

java.sql.SQLException: Unrecognized SQL type -102 while connecting to Oracle Database from Apache Spark

I’m trying to load a remote Oracle Database table on to Apache Spark shell.

This is how I started the spark-shell.

And I get a Scala prompt, where I try to load an Oracle database table like below. (I use a custom JDBC URL)

(Replaced employer data with dummy variables)

And then I get this error.

I tried to see if there is an issue with the quotes, but it’s not that.

Can somebody save my life, please?

Advertisement

Answer

The problem is an incompatible field in the database. If you cannot modify the database, but would still like to read it, the solution would be to ignore specific columns (in my case it’s a field with type geography). With the help of How to select specific columns through Spack JDBC?, here’s a solution in pyspark (scala solution would be similar):

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement