how to connect to HBase / Hadoop Database using C#

后端 未结 4 772
盖世英雄少女心
盖世英雄少女心 2021-02-11 04:49

Recently, Exploring Microsoft HDInsight Hadoop for Windows.But don\'t know where to began and start using apache hadoop with c# / asp.net mvc.

i know http://hadoopsdk.co

4条回答
  •  抹茶落季
    2021-02-11 04:51

    Microsoft released a preview of their .NET ProtoBuf client for Phoenix/Hbase on Nuget.org in June. I've found it worked well but the API was unfamiliar to me. As I learned it, I implemented a .NET Framework System.Data IDbConnection, IDbCommand et al wrapper API around it, named Garuda.Data. It makes access to Phoenix/Hbase from .NET code feel almost like SqlConnection, SqlCommand, etc for SQL Server - Check it out: https://www.nuget.org/packages/Garuda.Data/

    Here is the github project repo: https://github.com/dwdii/GarudaUtil

    And some example code:

    using (IDbConnection phConn = new PhoenixConnection())
    {
        phConn.ConnectionString = cmdLine.ConnectionString;
    
        phConn.Open();
    
        using (IDbCommand cmd = phConn.CreateCommand())
        {
            cmd.CommandText = "SELECT * FROM GARUDATEST";
            using (IDataReader reader = cmd.ExecuteReader())
            {
                while(reader.Read())
                {
                    for(int i = 0; i < reader.FieldCount; i++)
                    {
                        Console.WriteLine(string.Format("{0}: {1}", reader.GetName(i), reader.GetValue(i)));
                    }
                }
            }
        }                        
    }
    

提交回复
热议问题