How to run Apache Drill using C# Code
Below are the code for running the APACHE DRILL Programmatically.Sample code
var request = (HttpWebRequest)WebRequest.Create(url);
var postData = "name=" + name + "&config=" + config;
var data = Encoding.ASCII.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
if (responseString != null)
{
var jsonObject = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic> (responseString);
return jsonObject.result == "success";
}
Here, In above code, i am simply calling web request for connecting apache drill.
Above code create a storage plugin. Like wise we can delete the storage plugin or enable or disable the storage plugin through code.