How to connect Hive to asp.net project

前端 未结 1 1504
醉梦人生
醉梦人生 2021-01-15 20:25

Hi I\'m very new to Hadoop.

I have installed Microsoft HDInsight to my local system. Now I want to connect to hive and HBase but for HIVE connection I have to speci

相关标签:
1条回答
  • 2021-01-15 20:47

    Your best bet is probably to use Microsoft's Hive SDK (also available on nuget as Microsoft.Hadoop.Hive)

    There is a great sample on how to connect and run a Linq-to-Hive query at http://hadoopsdk.codeplex.com/wikipage?title=Simple%20Linq%20To%20Hive%20Query&referringTitle=LINQ%20to%20Hive

    This used the WebHcat API to submit your query to Hive, and will work against an HDInsights cluster in the Azure cloud (hence the need to provide a storage key to get the results back again).

    If you're only interested in using the local copy you can adapt the example to exclude the storage account credentials.

    var db = new HiveConnection(
                webHCatUri: new Uri("http://localhost:50111"),
                userName: (string) "hadoop", password: (string) null);
    
    var result = db.ExecuteHiveQuery("select * from w3c");
    result.Wait();
    

    works against a base install of HDInsight Preview.

    0 讨论(0)
提交回复
热议问题