cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update query from Azure databricks to Oracle table

bkbarunkalita64
New Contributor II

I need to update a single row on a on-prem Oracle table via jdbc connection.

Please note, I don't want to append, just have to update a row, is it possible ?

2 REPLIES 2

Anonymous
Not applicable

Hi @Tony S​ 

Great to meet you, and thanks for your question!

Let's see if your peers in the community have an answer to your question. Thanks.

Kaniz_Fatma
Community Manager
Community Manager

Hi @Tony S​ , This article mentioned all the steps required to establish a successful connection with the database using Python.

However, you can try this code :-

df.write.format("jdbc") \
  .option("url", dbServerJdbcUrl) \
  .option("user", username) \
  .option("password", password) \
  .option("driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver") \ # or "oracle.jdbc.driver.OracleDriver" for Oracle
  .option("dbtable", "your_table_name") \
  .mode('overwrite') \
  .save()

Make sure you have the necessary dependencies and libraries imported to use the write method with JDBC in PySpark.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!