Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.spark.SparkContext
- import org.apache.spark.SparkContext._
- import org.apache.spark.SparkConf
- import org.apache.spark.sql.SQLContext
- object SimpleApp {
- def main(args: Array[String]) {
- val conf = new SparkConf().setAppName("Simple Application")
- val sc = new SparkContext(conf)
- val sqlContext = new SQLContext(sc)
- import sqlContext.implicits._
- val commits = sqlContext.load("jdbc", Map(
- "url" -> "jdbc:postgresql://192.168.59.103:5432/postgres",
- "dbtable" -> "commits",
- "driver" -> "org.postgresql.Driver"))
- commits.select("message").show(1)
- }
- }
Add Comment
Please, Sign In to add comment