Load from a JDBC Datasource

You can load data from an external data source which supports Java Database Connectivity (JDBC). Using a JDBC driver, you can connect to a relational database such as Mysql and load the content of a table into Spark as shown in in the following code snippet:

 sqlContext.load(path=None, source=None, schema=None, **options)

The following is an example of loading from a JDBC datasource:

val dbContent = sqlContext.load(source="jdbc",  url="jdbc:mysql://localhost:3306/test",  dbtable="test",  partitionColumn="id")
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.189.63