Support Questions

Find answers, ask questions, and share your expertise

How does spark support connecting to two different databases in a single app

avatar
Explorer

I'm thinking to connect spark from MySQL to Postgres in one single app could anyone help me how to do it I have tried adding jars of both the DB's in the classpath but either of the one works, please shed light or guide me on this

1 ACCEPTED SOLUTION

avatar
@Naresh AR

You can create 2 different dataframes with 2 different jdbc sources(one with mysql and another one with postgres) and make sure both the jdbc jars are present in spark's classpath.

View solution in original post

2 REPLIES 2

avatar
@Naresh AR

You can create 2 different dataframes with 2 different jdbc sources(one with mysql and another one with postgres) and make sure both the jdbc jars are present in spark's classpath.

avatar
Explorer

@Sandeep Nemuri my use case was to move the MySQL data to PostgreSQL for which my cluster has 5tb ram and data may grow (as of now 200Million) is that achievable from spark and will that affect the cluster.

Previously data transfer was from sqoop to hive and then any target db