Databricks : connect to on-prem Oracle server

Viewed 46

I am trying to connect to an Oracle DB from Azure Databricks but get this error : not suitable driver".

I've installed the JDBC driver from JAR on my cluster.

Any ideas why ?

from pyspark.sql import SparkSession
spark = SparkSession.builder.config('spark.driver.extraClassPath', 'dbfs:/FileStore/jars/2103b47d_3261_47b2_bd0c_d7a6240c54f5-DatabricksJDBC42.jar').getOrCreate()
url = "jdbc:oracle:thin:@myserver:1521:db"
properties = {'user': 'myuser', 'password': 'mypassword'}
df = spark.read.jdbc(url=url, table='db.table', properties=properties)

Thank you

1 Answers

You just cite Databricks so it's not clear which platform/cloud vender specifically you're referring to.

Nevertheless, you can try to inspect the classpath/classloader to make sure which java/class/version is being loaded. Some links below:

Check -> Troubleshooting with the jinfo Utility https://docs.oracle.com/javase/9/troubleshoot/diagnostic-tools.htm#JSTGD198

JConsole https://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html

And, obviously, you can check it at the OS level as well: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html

With that, you might be able to confirm why you're getting the related message.

Related