Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

I want to export hive table data to sqlserver


I want to export hive table data to sqlserver



I have created HDInsight cluster on azure. I want to export hive table to SQL Server in Azure. For this I have created job in .Net SDK.

The code is as follows:

private static void SubmitSqoopJob()



{ var sqlDatabaseServerName = "hdpserver";

var sqlDatabaseLogin = "hdpadmin";

var sqlDatabaseLoginPassword = "*******";

var sqlDatabaseDatabaseName = "hadoopdb";

var azureTableName = "aztable1"; var hivedb="flight";

var hiveTable = "table1";

var connectionString = "jdbc:sqlserver://" + sqlDatabaseServerName + ";username=" + sqlDatabaseLogin + "@" + sqlDatabaseServerName + ";password=" + sqlDatabaseLoginPassword + ";database=" + sqlDatabaseDatabaseName;

var parameters = new SqoopJobSubmissionParameters {

Files = new List<string> { "/user/oozie/share/lib/sqoop/sqljdbc41.jar" }, // This line is required for Linux-based cluster.

Command = "export --connect " + connectionString + " --table " + azureTableName +" --hcatalog-database" + hivedb +" --hcatalog-table" + hiveTable };

System.Console.WriteLine("Submitting the Sqoop job to the cluster...");

var response = _hdiJobManagementClient.JobManagement.SubmitSqoopJob(parameters); System.Console.WriteLine("Validating that the response is as expected...");

System.Console.WriteLine("Response status code is " + response.StatusCode);

System.Console.WriteLine("Validating the response object...");

System.Console.WriteLine("JobId is " + response.JobSubmissionJsonResponse.Id);

} catch (Exception ex) { throw ex; } }

I am not able to load data to the SQL Server table using this code.

Don't have an account?
Coming from Hortonworks? Activate your account here