You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Jay Vyas <ja...@gmail.com> on 2014/05/16 18:00:57 UTC

Running a hive script from Java via API.

Hi hive.

Is there an API akin to PigServer, which allows you to run a hive script
from Java directly, using hive embedded mode, without use of JDBC?

-- 
Jay Vyas
http://jayunit100.blogspot.com

Re: Running a hive script from Java via API.

Posted by Edward Capriolo <ed...@gmail.com>.
Actually since hive 13 you seem to need a driver and a username and
password. The username and pw can be blank or whatever but
DriverManager.getConnection(url) does not seem to work any more.


On Fri, May 16, 2014 at 5:11 PM, Jay Vyas <ja...@gmail.com> wrote:

> So i guess your saying "yes : just use the JDBC driver with the
> jdbc:hive2://", and that is the equivalent of PigServer (with caveat that
> it can't run a hive script).
>
>
>

Re: Running a hive script from Java via API.

Posted by Jay Vyas <ja...@gmail.com>.
So i guess your saying "yes : just use the JDBC driver with the
jdbc:hive2://", and that is the equivalent of PigServer (with caveat that
it can't run a hive script).

Re: Running a hive script from Java via API.

Posted by Szehon Ho <sz...@cloudera.com>.
It is not really recommended anymore, as HiveServer2 with a client is the
where the community is focusing now.  And JDBC-client supports mode where
the HiveServer2 is embedded.

Some older product like HiveCLI or Beeline did like what you said, but
again this mode might not be fully supported.  For testing, you can execute
scripts from Driver.run(script).  Many examples in the hive unit-test code
about that.

Hope that helps,
Szehon


On Fri, May 16, 2014 at 9:00 AM, Jay Vyas <ja...@gmail.com> wrote:

> Hi hive.
>
> Is there an API akin to PigServer, which allows you to run a hive script
> from Java directly, using hive embedded mode, without use of JDBC?
>
> --
> Jay Vyas
> http://jayunit100.blogspot.com
>