未找到ODBC数据源名称,也未指定默认驱动程序



(环境为Linux CentOs7(

我在摆弄odbc.ini文件,每次更改时都会测试连接:

isql -v gdHive
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

在odbc.ini文件中,我一直在尝试描述-名称-值对的不同变体。最初设置为:

# Description: DSN Description.
Description=Hortonworks Hive ODBC Driver (64-bit) DSN

我试着把它改成

Description=gdHive

这并没有改变我在上面粘贴的错误。

这是整个配置,这是我第一次设置,所以我不确定我错过了什么:

# HS2 service discovery with ZooKeeper (ServiceDiscoveryMode=1).
ZKNamespace=/hive/hiveserver2
# Set to 1 if you are connecting to Hive Server 1. Set to 2 if you are connecting to Hive Server 2.
HiveServerType=2
# The authentication mechanism to use for the connection.
#   Set to 0 for No Authentication
#   Set to 1 for Kerberos
#   Set to 2 for User Name
#   Set to 3 for User Name and Password
# Note only No Authentication is supported when connecting to Hive Server 1.
AuthMech=1
# The Thrift transport to use for the connection.
#       Set to 0 for Binary
#       Set to 1 for SASL
#       Set to 2 for HTTP
# Note for Hive Server 1 only Binary can be used.
ThriftTransport=1
# When this option is enabled (1), the driver does not transform the queries emitted by an
# application, so the native query is used.
# When this option is disabled (0), the driver transforms the queries emitted by an application and
# converts them into an equivalent from in HiveQL.
UseNativeQuery=0
# Set the UID with the user name to use to access Hive when using AuthMech 2 to 8.
UID=
# The following is settings used when using Kerberos authentication (AuthMech 1 and 10)
# The fully qualified host name part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbHostFQDN to myhs2.mydomain.com
KrbHostFQDN=hive.hadoop.p3.int.example.com
# The service name part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbServiceName to hive
KrbServiceName=hive
# The realm part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbRealm to EXAMPLE.COM
KrbRealm=HADOOP.PROD.INT.EXAMPLE.COM
# Set to 1 to enable SSL. Set to 0 to disable.
SSL=0
# Set to 1 to enable two-way SSL. Set to 0 to disable. You must enable SSL in order to
# use two-way SSL.
TwoWaySSL=0
# The file containing the client certificate in PEM format. This is required when using two-way SSL.
ClientCert=
# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=
# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

错误消息只显示"未找到数据源名称,且未指定默认驱动程序"。我不确定如何设置此数据源名称或选择默认驱动程序?

"Description"关键字的值在ODBC DSN中完全是修饰性的。它没有任何功能用途。您可以将其设置为任意字符串。

ODBC将很难在黑暗中通过试错射击来学习。我建议您查看官方ODBC规范。您还可以查看环境中驱动程序管理器的一些文档,例如iODBC的文档或unixODBC的文档。