none
How to pass database connection string to spark commands through c# .NET RRS feed

  • Question

  • var spark = SparkSession.Builder().AppName("<app name>").GetOrCreate();

    DataFrame df=spark.sql(select * from [schema].[table name]);
    df.show();

    This is the above code that I tried to connect to the local database. It is a ubuntu 18.04 system. I get an error stating: Could not establish connection

    I know this is beacuse I have not specified the connectionString in the spark.sql command. How do I pass the connection string to the spark command?

    Should I use a different command , may be through JDBC drivers?

    I have tried using JDBC drivers also. 

    How do I proceed?

    Tuesday, December 3, 2019 10:29 AM

All replies

  • I don't see an SQL Server specific here, better ask in a Java/Spark Forum.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, December 3, 2019 11:01 AM
  • Hi Olaf, 

    Thanks for the reply. There is no such option of spark. The closest is Sql server. Hence raised my query here. 

    Thanks

    Tuesday, December 3, 2019 11:24 AM
  • Hi nidhin13,

    You can try to create a new thread in Spark Sql Forums, People there will help you more effectively. 
    Hope this could help you.

    Best regards,
    Cathy 

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to  MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, December 4, 2019 7:10 AM