0

In my Python notebook in Azure Databricks, the following import statement gives the error shown below. It seems I am missing some package.

What package am I missing, and how can I install it?

Ref: This post. Please note this linked post is using Scala, but I am using Python as I don't know Scala.

import java.sql.DriverManager

Error:

ModuleNotFoundError: No module named 'java'

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
nam
  • 21,967
  • 37
  • 158
  • 332
  • Does this answer your question? [How to run stored procedure on SQL server from Spark (Databricks) JDBC python?](https://stackoverflow.com/questions/66670313/how-to-run-stored-procedure-on-sql-server-from-spark-databricks-jdbc-python) – Alex Ott May 09 '22 at 08:39
  • `import java.sql.DriverManager` is for Java (and Scala), and implies running on the JVM (Java Virtual Machine). – Mark Rotteveel May 09 '22 at 09:50
  • Hello, it seems the code you are trying to run is for Scala notebook not Python. – Phuri Chalermkiatsakul May 11 '22 at 04:19
  • JPype? https://stackoverflow.com/questions/46353440/connecting-and-testing-a-jdbc-driver-from-python – tevemadar May 23 '22 at 14:14

1 Answers1

0

There is no java package you can install for CPython (with no modifier, Python refers to CPython); Run the code in Jython rather than CPython.

Jython integrates with Java and lets you import packages in Java's java.* namespace, such as java.sql.DriverManager. See here for more details.

charmoniumQ
  • 5,214
  • 5
  • 33
  • 51