cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
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
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.