You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Karthik Banala <ka...@gmail.com> on 2014/11/25 16:02:59 UTC

Re: using "SET" with JDBC

Hi ,

Two ways of doing it -

1. You can specify the configuration parameter in the JDBC URL while
establishing the connection

          jdbc:hive2://*serverName*:*port*?hive.exec.dynamic.partition.mode=nonstrict
;

2. Using statement/prepared statement

           ps.execute("hive.exec.dynamic.partition.mode=nonstrict") ;

Regards,
Karthik B


On Tue, Nov 25, 2014 at 4:07 AM, Guy Doulberg <Gu...@perion.com>
wrote:

>  Hi
>
>
>
> I am trying to use “SET” keyword in queries running using JDBC.
>
>
>
> For example:
>
> SET hive.exec.dynamic.partition.mode=nonstrict;
>
> SET hive.exec.dynamic.partition=true;
>
> SET hive.exec.max.created.files=1000000;
>
> Select count(*) from table;
>
>
>
>
>
> In order to do that , I split by “;”
>
> And then execute each of the lines using a for loop
>
>
>
>       for (String line : liness) {
>
>                 stmt.execute(query);
>
>             }
>
>
>
>
>
> I can see that the configuration do not passed correctly  to the job
>
>
>
> I can see in the configuration of the job running these conf ( with the
> “set” keyword):
>
>
>
> hive.exec.dynamic.partition.mode nonstrict
>
> SET hive.exec.dynamic.partition true;
>
> SET hive.exec.max.created.files 1000000
>
>
>
> How should I pass “set ” parameters using JDBC
>
>
>
> Thanks,
>
>
>
> *Guy Doulberg, *
>



-- 
Best Regards,
Karthik Banala
Ph No: 408-476-4580

RE: using "SET" with JDBC

Posted by Guy Doulberg <Gu...@perion.com>.
Option 1, is not good for me,

I  specify the connection string once for many statements



From: Karthik Banala [mailto:karthikbanala@gmail.com]
Sent: Tuesday, November 25, 2014 6:32 PM
To: user@hive.apache.org
Subject: Re: using "SET" with JDBC

You're right , Missed it We do  need to specify SET  keyword

    ps.execute("set hive.exec.dynamic.partition.mode=nonstrict") ;

Hope that works !!!
How about option 1 , specifying in URL works ???

On Tuesday, November 25, 2014, Guy Doulberg <Gu...@perion.com>> wrote:
Thanks

Isn’t the second is actually what I am doing?

I tried to remove the “SET” keyword and got sql exception.



From: Karthik Banala [mailto:karthikbanala@gmail.com<javascript:_e(%7B%7D,'cvml','karthikbanala@gmail.com');>]
Sent: Tuesday, November 25, 2014 5:03 PM
To: user@hive.apache.org<javascript:_e(%7B%7D,'cvml','user@hive.apache.org');>
Subject: Re: using "SET" with JDBC

Hi ,

Two ways of doing it -

1. You can specify the configuration parameter in the JDBC URL while establishing the connection

          jdbc:hive2://serverName:port?hive.exec.dynamic.partition.mode=nonstrict ;

2. Using statement/prepared statement

           ps.execute("hive.exec.dynamic.partition.mode=nonstrict") ;

Regards,
Karthik B


On Tue, Nov 25, 2014 at 4:07 AM, Guy Doulberg <Guy.Doulberg@perion.com<javascript:_e(%7B%7D,'cvml','Guy.Doulberg@perion.com');>> wrote:
Hi

I am trying to use “SET” keyword in queries running using JDBC.

For example:
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.dynamic.partition=true;
SET hive.exec.max.created.files=1000000;
Select count(*) from table;


In order to do that , I split by “;”
And then execute each of the lines using a for loop

      for (String line : liness) {
                stmt.execute(query);
            }


I can see that the configuration do not passed correctly  to the job

I can see in the configuration of the job running these conf ( with the “set” keyword):

hive.exec.dynamic.partition.mode nonstrict
SET hive.exec.dynamic.partition true;
SET hive.exec.max.created.files 1000000

How should I pass “set ” parameters using JDBC

Thanks,

Guy Doulberg,



--
Best Regards,
Karthik Banala
Ph No: 408-476-4580


--
Best Regards,
Karthik Banala
Ph No: 408-476-4580


Re: using "SET" with JDBC

Posted by Karthik Banala <ka...@gmail.com>.
You're right , Missed it We do  need to specify SET  keyword

    ps.execute("set hive.exec.dynamic.partition.mode=nonstrict") ;

Hope that works !!!
How about option 1 , specifying in URL works ???

On Tuesday, November 25, 2014, Guy Doulberg <Gu...@perion.com> wrote:

>  Thanks
>
>
>
> Isn’t the second is actually what I am doing?
>
>
>
> I tried to remove the “SET” keyword and got sql exception.
>
>
>
>
>
>
>
> *From:* Karthik Banala [mailto:karthikbanala@gmail.com
> <javascript:_e(%7B%7D,'cvml','karthikbanala@gmail.com');>]
> *Sent:* Tuesday, November 25, 2014 5:03 PM
> *To:* user@hive.apache.org
> <javascript:_e(%7B%7D,'cvml','user@hive.apache.org');>
> *Subject:* Re: using "SET" with JDBC
>
>
>
> Hi ,
>
>
>
> Two ways of doing it -
>
>
>
> 1. You can specify the configuration parameter in the JDBC URL while
> establishing the connection
>
>
>
>           jdbc:hive2://*serverName*:*port*?hive.exec.dynamic.partition.mode=nonstrict
> ;
>
>
>
> 2. Using statement/prepared statement
>
>
>
>            ps.execute("hive.exec.dynamic.partition.mode=nonstrict") ;
>
>
>
> Regards,
>
> Karthik B
>
>
>
>
>
> On Tue, Nov 25, 2014 at 4:07 AM, Guy Doulberg <Guy.Doulberg@perion.com
> <javascript:_e(%7B%7D,'cvml','Guy.Doulberg@perion.com');>> wrote:
>
>  Hi
>
>
>
> I am trying to use “SET” keyword in queries running using JDBC.
>
>
>
> For example:
>
> SET hive.exec.dynamic.partition.mode=nonstrict;
>
> SET hive.exec.dynamic.partition=true;
>
> SET hive.exec.max.created.files=1000000;
>
> Select count(*) from table;
>
>
>
>
>
> In order to do that , I split by “;”
>
> And then execute each of the lines using a for loop
>
>
>
>       for (String line : liness) {
>
>                 stmt.execute(query);
>
>             }
>
>
>
>
>
> I can see that the configuration do not passed correctly  to the job
>
>
>
> I can see in the configuration of the job running these conf ( with the
> “set” keyword):
>
>
>
> hive.exec.dynamic.partition.mode nonstrict
>
> SET hive.exec.dynamic.partition true;
>
> SET hive.exec.max.created.files 1000000
>
>
>
> How should I pass “set ” parameters using JDBC
>
>
>
> Thanks,
>
>
>
> *Guy Doulberg, *
>
>
>
>
>
> --
>
> Best Regards,
>
> Karthik Banala
>
> Ph No: 408-476-4580
>


-- 
Best Regards,
Karthik Banala
Ph No: 408-476-4580

RE: using "SET" with JDBC

Posted by Guy Doulberg <Gu...@perion.com>.
Thanks

Isn’t the second is actually what I am doing?

I tried to remove the “SET” keyword and got sql exception.



From: Karthik Banala [mailto:karthikbanala@gmail.com]
Sent: Tuesday, November 25, 2014 5:03 PM
To: user@hive.apache.org
Subject: Re: using "SET" with JDBC

Hi ,

Two ways of doing it -

1. You can specify the configuration parameter in the JDBC URL while establishing the connection

          jdbc:hive2://serverName:port?hive.exec.dynamic.partition.mode=nonstrict ;

2. Using statement/prepared statement

           ps.execute("hive.exec.dynamic.partition.mode=nonstrict") ;

Regards,
Karthik B


On Tue, Nov 25, 2014 at 4:07 AM, Guy Doulberg <Gu...@perion.com>> wrote:
Hi

I am trying to use “SET” keyword in queries running using JDBC.

For example:
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.dynamic.partition=true;
SET hive.exec.max.created.files=1000000;
Select count(*) from table;


In order to do that , I split by “;”
And then execute each of the lines using a for loop

      for (String line : liness) {
                stmt.execute(query);
            }


I can see that the configuration do not passed correctly  to the job

I can see in the configuration of the job running these conf ( with the “set” keyword):

hive.exec.dynamic.partition.mode nonstrict
SET hive.exec.dynamic.partition true;
SET hive.exec.max.created.files 1000000

How should I pass “set ” parameters using JDBC

Thanks,

Guy Doulberg,



--
Best Regards,
Karthik Banala
Ph No: 408-476-4580