TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pradeep Yadav
325
5.6k
2.7m
Create DSN using C#
May 6 2019 8:16 AM
Hi Team,
I am creting DSN for Hive driver using C#, we are able to create using below code
var driverKey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(ODBCINST_INI_REG_PATH + driverName);
if
(driverKey ==
null
)
throw
new
Exception(
string
.Format(
"ODBC Registry key for driver '{0}' does not exist"
, driverName));
string
driverPath = driverKey.GetValue(
"Driver"
).ToString();
var datasourcesKey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(ODBC_INI_REG_PATH +
"ODBC Data Sources"
);
if
(datasourcesKey ==
null
)
throw
new
Exception(
"ODBC Registry key for datasources does not exist"
);
datasourcesKey.SetValue(dsnName, driverName);
var dsnKey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(ODBC_INI_REG_PATH + dsnName);
if
(dsnKey ==
null
)
throw
new
Exception(
"ODBC Registry key for DSN was not created"
);
dsnKey.SetValue(
"Database"
, database);
dsnKey.SetValue(
"Description"
, description);
dsnKey.SetValue(
"Driver"
, driverPath);
dsnKey.SetValue(
"LastUser"
, Environment.UserName);
dsnKey.SetValue(
"Server"
, server);
dsnKey.SetValue(
"Database"
, database);
dsnKey.SetValue(
"AuthMech"
,
"3"
);
dsnKey.SetValue(
"UID"
,
"mapr"
);
dsnKey.SetValue(
"PWD"
,
"mapr"
);
However I want to set server side properties available in Advance options button by adding key and value.
I tried using below code
dsnKey.SetValue(
"hive.vectorized.execution.enabled"
,
"1"
);
dsnKey.SetValue(
"hive.vectorized.execution.reduce.enabled"
,
"1"
);
However, it is not working.
Please help me for the same
Reply
Answers (
2
)
Change SqlDataSource ConnectionString dynamically
listbox selection with in DropdownList in asp.Net ?.