4

With Apache Drill I can get the version through a JDBC connection by dispatching the query: SELECT version FROM sys.version. Is there an analogous way to determine the Hive version?

I know I can use hive --version from a machine where Hive is running and available via the command line. However a query-based approach would fit my use case a little better as JDBC connections may be made from anywhere inside my network.

Matt Pollock
  • 1,063
  • 10
  • 26
  • Drill directly works with Hive MetaStore, I not sure if its possible to get Hive version. – vgunnu May 06 '16 at 15:41
  • I really was just using drill to illustrate what I'm after. I'd like to do something similar to what I can already do with drill using just hive. I haven't found any way to discover a version via some query yet though. – Matt Pollock May 07 '16 at 15:08

2 Answers2

0

It's easy if you have a JDBC Connection.

Connection conn = // get it from somewhere
DatabaseMetaData md = conn.getMetadata();
System.out.println(md.getDatabaseMajorVersion() + "." + md.getDatabaseMinorVersion());

I don't know if you can get the information from a SQL/HiveQL query.

bgiles
  • 1,200
  • 11
  • 12
0

you can try this query

select version();
henryz
  • 35
  • 5