Home > Software design >  Query tempview using JDBC (Sql server)
Query tempview using JDBC (Sql server)

Time:04-19

I have a Temp view:

sales.createOrReplaceTempView("sales")

I want to use this tempView in a SQL server query:

select distinct
    t2.id,
    t1.prod
from prod t1 
join sales t2  on t2.id = t1.id

The prod table (t1) is stored in sql server and sales table (t2) is a tempView.

How should I run this query? Is it possible to run this using JDBC?

CodePudding user response:

Your Spark Application is running on a different cluster of machines out of which you are creating a temporary view. Your sql-server is running on a different machine and you created a table on it. These both components are speaking different languages of data. You can always connect them and bring either of these to the opposite platform and then work with the 2 tables/views on the common platform but you cannot simply join the tables on different platforms.

  • Related