diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java index a469cd49e6..2ba41e1e72 100644 --- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java +++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java @@ -110,6 +110,13 @@ public HiveSchemaTool(String hiveHome, HiveConf hiveConf, String dbType, String this.needsQuotedIdentifier = parser.needsQuotedIdentifier(); this.quoteCharacter = parser.getQuoteCharacter(); this.metaStoreSchemaInfo = MetaStoreSchemaInfoFactory.get(hiveConf, hiveHome, dbType); + // If the metaDbType is set, this is setting up the information schema in Hive. + // We will set the default jdbc url and driver. + // It is overriden by command line options if passed (-url and -driver) + if (metaDbType != null) { + url = HiveSchemaHelper.EMBEDDED_HS2_URL; + driver = HiveSchemaHelper.HIVE_JDBC_DRIVER; + } } public HiveConf getHiveConf() { diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java index 785978b1d9..70746e8e13 100644 --- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java +++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/tools/HiveSchemaHelper.java @@ -44,6 +44,9 @@ public static final String DB_MYSQL = "mysql"; public static final String DB_POSTGRACE = "postgres"; public static final String DB_ORACLE = "oracle"; + public static final String EMBEDDED_HS2_URL = "jdbc:hive2://"; + public static final String HIVE_JDBC_DRIVER = "org.apache.hive.jdbc.HiveDriver"; + /*** * Get JDBC connection to metastore db