how to call oracle stored proc in spark?

荒凉一梦 提交于 2019-12-26 08:21:54

问题


In my spark project , I am using spark-sql-2.4.1v.

As part of my code , I need to call oracle stored procs in my spark job.

how to call oracle stored procs?


回答1:


You can try doing something like this, though I have never tried this personally in any implementation

query = "exec SP_NAME"

empDF = spark.read \
    .format("jdbc") \
    .option("url", "jdbc:oracle:thin:username/password@//hostname:portnumber/SID") \
    .option("dbtable", query) \
    .option("user", "db_user_name") \
    .option("password", "password") \
    .option("driver", "oracle.jdbc.driver.OracleDriver") \
    .load()


来源:https://stackoverflow.com/questions/59455598/how-to-call-oracle-stored-proc-in-spark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!