我想使用连接到数据库 数据源名称:用于钻取DSN的MapR ODBC驱动程序,我在ODBC DATA SOURCE ADMINSTRATOR(64位)中创建了系统DSN名称。
我的代码是:
try
{
string connectionString = "DRIVER={org.apache.drill.jdbc.Driver};Data Source=MapR ODBC Driver for Drill DSN ; Initial Catalog=cp;Integrated Security=True ";
string sql = "SELECT * from cp.`employee.json`";
OdbcConnection conn = new OdbcConnection(connectionString);
conn.Open();
OdbcCommand comm = new OdbcCommand(sql, conn);
OdbcDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
Console.WriteLine(dr.GetValue(0).ToString());
Console.WriteLine(dr.GetValue(1).ToString());
Console.WriteLine(dr.GetValue(2).ToString());
}
conn.Close();
dr.Close();
comm.Dispose();
conn.Dispose();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadKey();
}
当我运行此代码时,它显示错误:
找不到数据源名称且未指定默认驱动程序。
请帮帮我。