- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Is their any way to configure new datbase for spark-sql in hdp 2.6
- Labels:
-
Hortonworks Data Platform (HDP)
Created ‎04-12-2019 02:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Will you please please help me to configure new database.
By default the spark-sql is connecting to the hive, so i want to configure new database like postgreSQL instead of hive
it will be very help full to rectify for me
Created ‎04-12-2019 03:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Spark SQL data source can read data from other databases using JDBC.JDBC connection properties such as user and password are normally provided as connection properties for logging into the data sources.
In the example below I am using MySQL, so will need to have the Postgres drivers in place
Sample Program
import org.apache.spark.sql.SQLContext val sqlcontext = new org.apache.spark.sql.SQLContext(sc) val dataframe_mysql = sqlcontext.read.format("jdbc").option("url", "jdbc:mysql://mbarara.com:3306/test").option("driver", "com.mysql.jdbc.Driver").option("dbtable", "emp").option("user", "root").option("password", "welcome1").load() dataframe_mysql.show()
Hope that helps
Created ‎04-12-2019 03:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Spark SQL data source can read data from other databases using JDBC.JDBC connection properties such as user and password are normally provided as connection properties for logging into the data sources.
In the example below I am using MySQL, so will need to have the Postgres drivers in place
Sample Program
import org.apache.spark.sql.SQLContext val sqlcontext = new org.apache.spark.sql.SQLContext(sc) val dataframe_mysql = sqlcontext.read.format("jdbc").option("url", "jdbc:mysql://mbarara.com:3306/test").option("driver", "com.mysql.jdbc.Driver").option("dbtable", "emp").option("user", "root").option("password", "welcome1").load() dataframe_mysql.show()
Hope that helps
Created ‎04-30-2019 05:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Geoffrey Shelton Okot Thanks a lot helping in this
