Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 05-17-2018 10:35 PM
can I execute update statement using
spark.read.format("jdbc").options(
Map("driver" -> "oracle.jdbc.driver.OracleDriver",<br> "url" -> url,<br> "dbtable" -> sqlUpdate,<br> "user" -> username,<br> "password" -> password)).load()
?
Created 05-18-2018 04:33 PM
@Anuj Tanwar AFAIK updates are supported with spark jdbc. Alternative is to use standard jdbc - You can read more here https://stackoverflow.com/questions/34643200/spark-dataframes-upsert-to-postgres-table
*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.
Created 05-18-2018 04:33 PM
@Anuj Tanwar AFAIK updates are supported with spark jdbc. Alternative is to use standard jdbc - You can read more here https://stackoverflow.com/questions/34643200/spark-dataframes-upsert-to-postgres-table
*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.
Created 05-18-2018 04:34 PM
I used OracleDataSource() to make connection and it worked.
val ods = new OracleDataSource()
ods.setUser(username)
ods.setPassword(password)
ods.setURL(url)
val connection = ods.getConnection()
connection.setAutoCommit(false)
val prepUpdateStat = connection.prepareStatement(sqlUpdate)
prepUpdateStat.execute()
connection.commit()
prepUpdateStat.close()