How to connect Hive to asp.net project

拈花ヽ惹草 提交于 2019-12-01 13:32:22

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!