hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takahiko Saito <tysa...@gmail.com>
Subject Re: How to set idle Hive jdbc connection out from java code using hive jdbc
Date Tue, 08 Mar 2016 01:20:46 GMT
I don't think *hive.server2.idle.session.timeout can be set via client. It
might need to be set on server side.*
*So before you run your query, you might need to restart HS2 with that
property set, but I'm not sure that's what you are looking for.*

On Sun, Nov 29, 2015 at 11:50 PM, reena upadhyay <reena2485@gmail.com>
wrote:

> I am using hive jdbc 1.0 in my java application to create connection with
> hive server and execute query. I want to set the idle hive connection
> timeout from java code. Like say, user first creates the hive connection,
> and if the hive connection remains idle for next 10 minutes, then this
> connection object should get expired. If user uses this same connection
> object after 10 minutes for executing query, then hive jdbc should throw
> error. Can you please tell me the way to achieve this through java code.
>
> I know there is a property *hive.server2.idle.session.timeout *in hive,
> but I don't know whether this is the right property required to be set from
> java code or there is some other property. I tried setting this property in
> jdbc connection string but it did not worked.
>
>         try {
>                 Class.forName("org.apache.hive.jdbc.HiveDriver");
>             } catch (ClassNotFoundException e) {
>                 LOG.error(ExceptionUtils.getStackTrace(e));
>             }
>
>             String jdbcurl = "
> *jdbc:hive2://localhost:10000/idw?hive.server2.idle.session.timeout=1000ms";*
>             Connection con;
>             con = DriverManager.getConnection(jdbcurl,"root","");
>
>             Thread.sleep(3000);
>
> Now below I am using connection object, hive jdbc should throw error here
> as I used connection object after 3000 ms but I had set the idle timeout as
> 1000ms but hive jdbc had not thrown error
>
>             ResultSet rs = con.createStatement().executeQuery("select *
> from idw.emp");
>
> Need help on this.
>



-- 
Takahiko Saito

Mime
View raw message