[nbj2ee] Hadoop Hive query

  • From: "rajeshn" < >
  • To:
  • Subject: [nbj2ee] Hadoop Hive query
  • Date: Wed, 12 Dec 2012 01:10:16 -0500

Hi,
   I am using Netbeans 7.1.2. I need to execute hadoop hive query from within 
netbeans project. 

   For your notification, i have a Java web project which can query and 
produce result from a mysql table with given user input.

Sample jsp code:
*********************
<%@ page import="java.sql.*" %>
<html>
<body>
<br><br>
<form method="post" name="form">
<table border="1">
    
<tr><th>Id</th><th>NodeId</th><th>Time</th><th>Voltage(volts)</th><th>Temperature(celcius)</th><th>Light</th></tr>
<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "motes";
String driver = "com.mysql.jdbc.Driver";
String userName ="root";
String password="root";
int sumcount=0;
Statement st;
try{
Class.forName(driver).newInstance();
con = DriverManager.getConnection(url+db,userName,password);
String query = "select Id,nodeid,result_time,voltage,temp,light from 
xbwda100results where nodeid=1";
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
%>
<%
while(rs.next()){
%>
<tr><td><%=rs.getString(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getString(5)%></td>
<td><%=rs.getString(6)%></td>
</tr>
<%
}
%>
<%
}
catch(Exception e){
e.printStackTrace();
}
%>
</table>
</form>
</body>
</html>


    I need to know how can i execute a hive query similar to "hive -e 'select 
* from tablename;'". I need to execute this in a jsp page like the above one.

    I have tried it with php and sh files, but no use. It only downloads the 
sh file or it enters into infinite loop or something and the system hangs 
until restart.

    Please, i need a solution.






[nbj2ee] Hadoop Hive query

rajeshn 12/12/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close