private static void createDb() throws Exception {
    Connection conn = DriverManager.
        getConnection(miniHS2.getJdbcURL(), System.getProperty("user.name"), "bar");
    Statement stmt2 = conn.createStatement();
    stmt2.execute("DROP DATABASE IF EXISTS " + dbName + " CASCADE");
    stmt2.execute("CREATE DATABASE " + dbName);
    stmt2.close();
    conn.close();
  }
This class is cloned from TestJdbcWithMiniMR, except use Namenode HA.
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHA.java