Hive uses a default H2 database instance bundled that comes with BAM to persist Hive table definitions and other metadata. This configuration is given in <BAM_HOME>/repository/conf/advanced/hive-site.xml
file as follows:
Code Block |
---|
|
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:h2://${CARBON_HOME}/repository/database/metastore_db</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org.h2.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>wso2carbon</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>wso2carbon</value>
<description>password to use against metastore database</description>
</property>
|
Info |
---|
|
In production setups, we recommend to use |
...
an external database instance such |
...
as MySQL, MSSQL, Oracle or Derby, instead of the |
...
embedded H2 database. For databases other than H2, you need to create the metastore_db database, while in H2 it is being created. Change the <BAM_HOME>/repository/conf/ advanced/hive-site.xml file to point to the external database instance created. If you are on Windows, use the hive-site-win.xml file in the same folder. |
For example, the following code connects to an external Oracle database as the Hive metedata store:
Code Block |
---|
|
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:h2://${CARBON_HOME}/repository/database/metastore_db<:oracle:thin:@<ip>:<port>:<SID></value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>org<value>oracle.jdbc.h2driver.Driver<OracleDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>wso2carbon<<value><USERNAME></value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>wso2carbon<<value><PASSWORD></value>
<description>password to use against metastore database</description>
</property>
|
Info |
---|
For databases other than H2, add the database driver to <BAM_HOME>/repository/components/lib and restart the server. |