How to Call Oracle Stored Procedures from Databricks?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2022 02:53 AM
How to Call Oracle Stored Procedures from Databricks?
- Labels:
-
Databricks notebook
-
Databricks SQL
-
Oracle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2022 03:13 AM
here i have code
- val url =
- "jdbc:mysql://yourIP:yourPort/test?
- user=yourUsername; password=yourPassword"
- val df = sqlContext
- .read
- .format("jdbc")
- .option("url", url)
- .option("dbtable", "people")
- .load()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 03:52 PM
Chiming in because I don't know if the above quite answers how to execute a stored procedure. I use PySpark. I believe this should work for oracle, but only was able to test it with MS Sql Server. I had to truncate a table, but the code works for a stored procedure as well.
General idea is to get the jdbc connection from the jvm gateway and use that to execute sql commands.
sqlSurl = "jdbc:[driver]//ip..."
con = (sc._gateway
.jvm
.java
.sql
.DriverManager
.getConnection(sqlsUrl, \
username, \
password)
)
con.prepareCall(query).execute()
con.close()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 04:29 AM
Check this link, maybe it will help you solve this problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2023 12:16 AM
Thanks it helps me as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 09:40 PM
https://datathirst.net/blog/2018/10/12/executing-sql-server-stored-procedures-on-databricks-pyspark/
try this link. this may help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2023 12:16 AM
It was needed me as well so thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2026 10:21 AM
Read article on thelogicplus