vendredi 14 août 2015

Connecting to HIVE using a .Net application

I am trying to create a POC for one of my projects which would allow me to connect to HIVE using an ODBC connection string.

I have been successful in using a DSN method to connect to HIVE. But this doesnt work for me cause I would need to allow create connections during run time where the connection source can be changed from one host to another.

I am using the following connection string (using the Microsoft ODBC driver) which I took from http://ift.tt/1hGpqvN

var conn = new OdbcConnection {
    ConnectionString = @
    "DRIVER={Microsoft Hive ODBC Driver};
Host=<IP>;
Port=10000;
User Name=root;Password=<PWD>;
Database=default;
HiveServerType=2;
ApplySSPWithQueries=1;
TrustedCerts=C:\Program Files\Microsoft Hive ODBC Driver\lib\cacerts.pem;
AsyncExecPollInterval=100;
AuthMech=0;
CAIssuedCertNamesMismatch=0;"
}

using(conn) {
    conn.Open();
    DataTable dt = new DataTable();
    OdbcCommand cmd = conn.CreateCommand();
    cmd.CommandText =
        "SELECT * FROM categories;";

    int k = 0;
    DbDataReader dr = await cmd.ExecuteReaderAsync();
    dt.Load(dr);
}

When I try to open the connection, I get a network timeout.

ERROR [HY000] [Microsoft][HiveODBC] (34) Error from Hive: ETIMEDOUT.

I am not sure how to fix this up.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire