Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C767C912F for ; Wed, 25 Apr 2012 08:36:28 +0000 (UTC) Received: (qmail 35614 invoked by uid 500); 25 Apr 2012 08:36:28 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 35571 invoked by uid 500); 25 Apr 2012 08:36:28 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 35542 invoked by uid 500); 25 Apr 2012 08:36:27 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 35538 invoked by uid 99); 25 Apr 2012 08:36:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 08:36:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 08:36:24 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 7D7F735FE25 for ; Wed, 25 Apr 2012 08:36:03 +0000 (UTC) Date: Wed, 25 Apr 2012 08:36:03 +0000 (UTC) From: "alex gemini (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: <1738662552.86.1335342963563.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <684677195.36046.1332242618007.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HIVE-2882) Problem with Hive using JDBC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-2882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261399#comment-13261399 ] alex gemini commented on HIVE-2882: ----------------------------------- hive didn't support cursor in JDBC world.if you intend iterate through a result set,maybe you should first execute the query and store it,and using your client logic to generate second query .this maybe a more PIG GENERATE case.I suggest close this. > Problem with Hive using JDBC > ---------------------------- > > Key: HIVE-2882 > URL: https://issues.apache.org/jira/browse/HIVE-2882 > Project: Hive > Issue Type: Bug > Components: JDBC > Affects Versions: 0.7.1 > Environment: Operating System - Ubuntu 11.10 > Softwares - Hadoop-0.20.2, Hive-0.7.1 > Reporter: Bhavesh Shah > Priority: Critical > Labels: hadoop, hive > Original Estimate: 168h > Remaining Estimate: 168h > > I am trying to implement a task in Hive (Similar to Stored Procedure in SQL (Block of queries)). > In SQL, when we write cursor, first we execute select query and then fetching the records we perform some actions. > Likely I have fired a select query in Hive as: > String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; > Class.forName(driverName); > Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", ""); > String sql=null; > Statement stmt = con.createStatement(); > Statement stmt1 = con.createStatement(); > ResultSet res=null; > ResultSet rs1=null; > sql="select a,c,b from tbl_name"; > res=stmt.executeQuery(); -----------> CONTAINS 30 RECORDS > while(res.next()) > { > sql="select d,e,f, from t1"; > rs1=stmt1.executeQuery(); > like wise many queries are there..... > . > . > . > .. > } > But the problem is that while loop executes only once instead of 30 times when the inner query (inside while) gets execute. > And If I create two different connection for both the queries then all works fine. > Like: > String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; > Class.forName(driverName); > Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", ""); > Connection con1 = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", ""); > String sql=null; > Statement stmt = con.createStatement(); > Statement stmt1 = con1.createStatement(); > ResultSet res=null; > ResultSet rs1=null; > To sum up, when I iterate through a result set do I need to use a different connection(and statement object) to > execute other queries???? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira