I am trying to use the method savetable in the Spark JdbcUtils
The defination of the method is the following. It accepts the JDBCOptions as one of the parameter.
def saveTable(
df: DataFrame,
tableSchema: Option[StructType],
isCaseSensitive: Boolean,
options: JDBCOptions)
Following is the class of the JDBCOptions
While i am initializing the JDBCOptions with the url,transaction isolation level etc it is throwing errors.
Can you provide insights in initialization of the JDBCOptions
val options :JDBCOptions = Map("url" -> "JDBCUrl")
Error Type Map doesnt conform to be JDBCOption Type
How to initialize with correct type ?
You need to wrap the Map in a new JDBCOptions(...)
call
// url and dbtable are required
val options:JDBCOptions = new JDBCOptions(Map("url" -> "JDBCUrl", "dbtable" -> "foo"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.