You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@knox.apache.org by Jeffrey Rodriguez <je...@gmail.com> on 2021/09/03 21:56:44 UTC
Jdbc access through Knox Hive endpoint.
Hi Apache Knox users,
Working on Hive access through Knox. In CDP cloud it
advertises endpoint
"jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site/;ssl=true;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
It would really nice if somebody has figure out how to use Knox Hive
endpoints to access Hive server 2 (http - which is what mine uses).
According to my theory this should work
```
import jaydebeapi
url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
#Connect to HiveServer2
# ..... classpath to to hadoop, hive client jars......
conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
cursor = conn.cursor()
# Execute SQL query
sql="show databases"
cursor.execute(sql)
results = cursor.fetchall()
print( results )
import jaydebeapi
url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
#Connect to HiveServer2
# ..... classpath to to hadoop, hive client jars......
conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
cursor = conn.cursor()
# Execute SQL query
sql="show databases"
cursor.execute(sql)
results = cursor.fetchall()
print( results )
```
Thanks,
Jeff Rodriguez
Re: Jdbc access through Knox Hive endpoint.
Posted by Jeffrey Rodriguez <je...@gmail.com>.
Hi Larry,
Thanks for your response. After careful reviewing, I notice I had a
minor typo on my JDBC string.
```
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/opt/cloudera/parcels/CDH-7.2.8-1.cdh7.2.8.p0.11560957/jars/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/opt/cloudera/parcels/CDH-7.2.8-1.cdh7.2.8.p0.11560957/jars/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
<jaydebeapi.Cursor object at 0x7ff6feafa5c0>
[('adobe_dart',), ('ccm_subscrpn_analytics',), ('ccm_subscrpn_raw',),
('ccm_subscrpn_transformed',), ('darwin',), ('darwin_stage',),
('datamart_ops',), ('default',), ('drax',), ('ets_ingest',),
('gdprcpir',), ('information_schema',), ('ocf_analytics',),
('ocf_mci_analytics',), ('ocf_raw',), ('ocf_transformed',),
('sophia',), ('sys',), ('tpcds_bin_partitioned_orc_10',),
('tpcds_text_10',)]
```
It is working as expected.
FYI.
On my Linux client my sslTrustore and default password. This is needed
since connection is through SSL.
sslTrustStore=/etc/pki/java/cacerts;trustStorePassword=changeit
full URL:
url="jdbc:hive2://server.cloudera.site/default;user=foo;password=bar;ssl=true;sslTrustStore=/etc/pki/java/cacerts;trustStorePassword=changeit;transportMode=http;httpPath=server/cdp-proxy-api/hive"
Thanks again,
Jeff Rodriguez
On Sat, Sep 4, 2021 at 5:54 AM larry mccay <lm...@apache.org> wrote:
>
> Hi Jeff -
>
> Can you share the errors that you are encountering?
>
> Thanks,
>
> --larry
>
> On Fri, Sep 3, 2021, 5:57 PM Jeffrey Rodriguez <je...@gmail.com> wrote:
>>
>> Hi Apache Knox users,
>> Working on Hive access through Knox. In CDP cloud it
>> advertises endpoint
>> "jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site/;ssl=true;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
>> It would really nice if somebody has figure out how to use Knox Hive
>> endpoints to access Hive server 2 (http - which is what mine uses).
>> According to my theory this should work
>> ```
>> import jaydebeapi
>>
>> url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
>>
>> #Connect to HiveServer2
>> # ..... classpath to to hadoop, hive client jars......
>>
>> conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
>> cursor = conn.cursor()
>>
>> # Execute SQL query
>> sql="show databases"
>> cursor.execute(sql)
>> results = cursor.fetchall()
>> print( results )
>> import jaydebeapi
>>
>> url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
>>
>> #Connect to HiveServer2
>> # ..... classpath to to hadoop, hive client jars......
>>
>> conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
>> cursor = conn.cursor()
>>
>> # Execute SQL query
>> sql="show databases"
>> cursor.execute(sql)
>> results = cursor.fetchall()
>> print( results )
>> ```
>>
>> Thanks,
>> Jeff Rodriguez
Re: Jdbc access through Knox Hive endpoint.
Posted by larry mccay <lm...@apache.org>.
Hi Jeff -
Can you share the errors that you are encountering?
Thanks,
--larry
On Fri, Sep 3, 2021, 5:57 PM Jeffrey Rodriguez <je...@gmail.com> wrote:
> Hi Apache Knox users,
> Working on Hive access through Knox. In CDP cloud it
> advertises endpoint
>
> "jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site/;ssl=true;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
> It would really nice if somebody has figure out how to use Knox Hive
> endpoints to access Hive server 2 (http - which is what mine uses).
> According to my theory this should work
> ```
> import jaydebeapi
>
>
> url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
>
> #Connect to HiveServer2
> # ..... classpath to to hadoop, hive client jars......
>
> conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
> cursor = conn.cursor()
>
> # Execute SQL query
> sql="show databases"
> cursor.execute(sql)
> results = cursor.fetchall()
> print( results )
> import jaydebeapi
>
>
> url="jdbc:hive2://mywackyserrver-manager0.pood-st.zc6q-kczr.cloudera.site:8443/default;user=wacky;password=wacky;ssl=true;sslTrustStore=/mytrustore;trustStorePassword=changeme;transportMode=http;httpPath=mywackyserver/cdp-proxy-api/hive"
>
> #Connect to HiveServer2
> # ..... classpath to to hadoop, hive client jars......
>
> conn=jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", url)
> cursor = conn.cursor()
>
> # Execute SQL query
> sql="show databases"
> cursor.execute(sql)
> results = cursor.fetchall()
> print( results )
> ```
>
> Thanks,
> Jeff Rodriguez
>