Hive JDBC connection setting or mapping with MySQL

2019-08-23 09:55发布

问题:

I am new to big data; technically I am a Java developer and decided to learn big data concepts. I am just able to install Hadoop and Hive, and now I want to connect my Java program to Hive. I have configured MySQL as a back-end db.

Tried to Google it and found a few Java program sample where they are using something like this URL jdbc:hive2://172.16.149.158:10000/default,"","".

My question is I didn't made any setting like this in hive-sites.xml. Where should I made these setting or if not than where to find out which setting I should use?

回答1:

Port 10000 is the default port for HiveServer2, which enables clients to execute queries against Hive.

This configuration is set in hive-site.xml via the property hive.server2.thrift.port

<property>
  <name>hive.server2.thrift.port</name>
  <value>10000</value>
</property>

More details on HiveServer2 are here

Also, the default in the URL is the default Hive database.